aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-02-22 02:42:47 +0000
committerBlaž Hrastnik2021-02-22 02:42:47 +0000
commit5096bdad331610994b90e31e7a53c94b6bc831ba (patch)
tree4d1efd2cec807a6d76acc0b401d8d31e090f7713
parent9132c6a591fc4515cdddfd16cc382fc3368ed27c (diff)
completion: Use the language server bound to the document.
-rw-r--r--helix-term/src/commands.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index bf6f0c88..b6d8d818 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -900,15 +900,13 @@ pub fn save(cx: &mut Context) {
}
pub fn completion(cx: &mut Context) {
- let language_server = cx
- .editor
- .language_servers
- .get("source.rust", &cx.executor)
- .unwrap();
- use log::info;
-
let doc = cx.doc();
+ let language_server = match doc.language_server.as_ref() {
+ Some(language_server) => language_server,
+ None => return,
+ };
+
// TODO: blocking here is not ideal
let pos = helix_lsp::util::pos_to_lsp_pos(doc.text().slice(..), doc.selection().cursor());