summaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-12-23 08:03:20 +0000
committerBlaž Hrastnik2020-12-23 09:16:17 +0000
commitcd16df19c1f951e1ef0c560ae5e084b18bd2c713 (patch)
tree82b1431a96c914033fff8b79fcdcda9f535a16f9 /helix-term/src
parent56f2193811fca2fa20284442c2042fa271464445 (diff)
lsp: generate_transaction_from_text_edits
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index eb23041c..862cf312 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -837,17 +837,32 @@ 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 res = smol::block_on(language_server.completion(&cx.view.doc)).expect("completion failed!");
+ let res = smol::block_on(
+ language_server
+ .completion(&cx.view.doc)
+ .timeout(Duration::from_secs(2)),
+ )
+ .expect("completion failed!")
+ .expect("completion failed!");
let picker = ui::Picker::new(
res,
|item| {
// format_fn
item.label.as_str().into()
+
+ // TODO: use item.filter_text for filtering
},
|editor: &mut Editor, item| {
+ // if item.text_edit is Some we use that, else
+ // let insert_text = &item.insert_text.unwrap_or(item.label);
+ // and we insert at position.
//
+ // merge this with additional_text_edits
},
);