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

fix: Respect workspace-lsp-roots on doc opening #12223

Merged

Conversation

sysheap
Copy link

@sysheap sysheap commented Dec 9, 2024

When a new language server is started, find_lsp_workspace is called with LanguageConfiguration::workspace_lsp_roots as the root_dirs argument.

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.

I don't quite understand why the field editor::Config::workspace_lsp_roots exists when it is never used. Is it something LSP specific?

I'm also happy to change this PR if someone can point me into the right direction if the current fix is wrong.

Thanks a lot!

Closes #12222

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.
@the-mikedavis the-mikedavis added the A-language-server Area: Language server client label Dec 9, 2024
@the-mikedavis
Copy link
Member

I don't quite understand why the field editor::Config::workspace_lsp_roots exists when it is never used

Like LanguageConfiguration::workspace_lsp_roots it can be set by configuration but in config.toml instead of languages.toml.

Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find, thanks!

@the-mikedavis the-mikedavis merged commit b946b21 into helix-editor:master Dec 22, 2024
6 checks passed
@sysheap sysheap deleted the fix-root-dirs-on-add-document branch December 22, 2024 14:25
CedricMeu pushed a commit to CedricMeu/helix that referenced this pull request Jan 2, 2025
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.
GladkihEgor pushed a commit to GladkihEgor/helix that referenced this pull request Jan 4, 2025
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.
diucicd pushed a commit to diucicd/helix that referenced this pull request Jan 8, 2025
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.
rmburg pushed a commit to rmburg/helix that referenced this pull request Jan 20, 2025
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-server Area: Language server client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

workspace-lsp-roots is not used when opening a new document under the same language server
3 participants