From 5aed1f3c0049d7c00729c8a5e09ba1dc497d037c Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Wed, 7 Apr 2021 13:38:24 +0900 Subject: lsp: Gracefully fail if binary doesn't exist. --- helix-lsp/src/lib.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'helix-lsp/src/lib.rs') 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>, + inner: HashMap>>, pub incoming: SelectAll>, } @@ -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 -- cgit v1.2.3-70-g09d2