summaryrefslogtreecommitdiff
path: root/helix-lsp/src/lib.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-04-07 04:38:24 +0000
committerBlaž Hrastnik2021-04-07 04:38:24 +0000
commit5aed1f3c0049d7c00729c8a5e09ba1dc497d037c (patch)
tree1e088934be6179f703f56a14654ca5f7217288b0 /helix-lsp/src/lib.rs
parent9dfd6f6bbcdc38491b20c37c7b24d83aacf194d7 (diff)
lsp: Gracefully fail if binary doesn't exist.
Diffstat (limited to 'helix-lsp/src/lib.rs')
-rw-r--r--helix-lsp/src/lib.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs
index 89054345..40d2e477 100644
--- a/helix-lsp/src/lib.rs
+++ b/helix-lsp/src/lib.rs
@@ -104,7 +104,7 @@ use crate::select_all::SelectAll;
use smol::channel::Receiver;
pub struct Registry {
- inner: HashMap<LanguageId, Arc<Client>>,
+ inner: HashMap<LanguageId, Option<Arc<Client>>>,
pub incoming: SelectAll<Receiver<Call>>,
}
@@ -140,17 +140,19 @@ impl Registry {
// TODO: lookup defaults for id (name, args)
// initialize a new client
- let (mut client, incoming) = Client::start(&ex, &config.command, &config.args);
+ let (mut client, incoming) =
+ Client::start(&ex, &config.command, &config.args).ok()?;
+
// TODO: run this async without blocking
smol::block_on(client.initialize()).unwrap();
s_incoming.push(incoming);
- Arc::new(client)
+ Some(Arc::new(client))
})
.clone();
- return Some(language_server);
+ return language_server;
}
None