aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-01-06 08:48:14 +0000
committerBlaž Hrastnik2021-01-06 08:48:14 +0000
commit941c34a7fc86e613b41887174c699be52ab202a8 (patch)
tree36bdaf9f2ac4ff19e01ba4588639785e5093999b /helix-term
parentb2800489dedb44cf030cd425d737ea14491518aa (diff)
lsp: Move timeouts into client.request
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs14
1 files changed, 4 insertions, 10 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 4f250247..8216437d 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -857,21 +857,15 @@ pub fn completion(cx: &mut Context) {
let language_server = cx.language_servers.get("rust", &cx.executor).unwrap();
use log::info;
- use smol_timeout::TimeoutExt;
- use std::time::Duration;
-
// TODO: blocking here is not ideal
let pos = helix_lsp::util::pos_to_lsp_pos(
&cx.view.doc.text().slice(..),
cx.view.doc.selection().cursor(),
);
- let res = smol::block_on(
- language_server
- .completion(cx.view.doc.identifier(), pos)
- .timeout(Duration::from_secs(2)),
- )
- .expect("completion failed!")
- .unwrap_or_default(); // if timeout, just return
+
+ // TODO: handle fails
+ let res = smol::block_on(language_server.completion(cx.view.doc.identifier(), pos))
+ .unwrap_or_default();
// TODO: if no completion, show some message or something
if !res.is_empty() {