From ef532e0c0df3e9f8bf4ac5af74b54f32b7ea2728 Mon Sep 17 00:00:00 2001 From: Kirawi Date: Wed, 15 Sep 2021 01:58:06 -0400 Subject: log errors produced when trying to initialize the LSP (#746) --- helix-lsp/src/lib.rs | 10 +++++++++- helix-view/src/editor.rs | 12 ++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index 7357c885..35cff754 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -318,7 +318,15 @@ impl Registry { let (client, incoming, initialize_notify) = Client::start( &config.command, &config.args, - serde_json::from_str(language_config.config.as_deref().unwrap_or("")).ok(), + serde_json::from_str(language_config.config.as_deref().unwrap_or("")) + .map_err(|e| { + log::error!( + "LSP Config, {}, in `languages.toml` for `{}`", + e, + language_config.scope() + ) + }) + .ok(), id, )?; self.incoming.push(UnboundedReceiverStream::new(incoming)); diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 52a0060c..a3d0d032 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -249,10 +249,14 @@ impl Editor { let mut doc = Document::open(&path, None, Some(&self.theme), Some(&self.syn_loader))?; // try to find a language server based on the language name - let language_server = doc - .language - .as_ref() - .and_then(|language| self.language_servers.get(language).ok()); + let language_server = doc.language.as_ref().and_then(|language| { + self.language_servers + .get(language) + .map_err(|e| { + log::error!("Failed to get LSP, {}, for `{}`", e, language.scope()) + }) + .ok() + }); if let Some(language_server) = language_server { let language_id = doc -- cgit v1.2.3-70-g09d2