Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log errors produced when trying to initialize the LSP #746

Merged
merged 1 commit into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion helix-lsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
12 changes: 8 additions & 4 deletions helix-view/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down