Skip to content

Commit

Permalink
fix: Respect workspace-lsp-roots on doc opening (helix-editor#12223)
Browse files Browse the repository at this point in the history
When a new language server is started, find_lsp_workspace is called
with LanguageConfiguration::workspace_lsp_roots as the root_dirs.

This behavior is different when a new document is opened.
find_lsp_workspace is called with editor::Config::workspace_lsp_roots
which is never set.

This leads to a bug where workspace-lsp-roots is not respected when
opening a new document. This commit fixes this bug.
  • Loading branch information
sysheap authored and rmburg committed Jan 20, 2025
1 parent 611fe8b commit 3546603
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion helix-lsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,11 @@ impl Registry {
}

if let Some((_, client)) = clients.iter().enumerate().find(|(i, client)| {
client.try_add_doc(&language_config.roots, root_dirs, doc_path, *i == 0)
let manual_roots = language_config
.workspace_lsp_roots
.as_deref()
.unwrap_or(root_dirs);
client.try_add_doc(&language_config.roots, manual_roots, doc_path, *i == 0)
}) {
return Some((name.to_owned(), Ok(client.clone())));
}
Expand Down

0 comments on commit 3546603

Please sign in to comment.