Skip to content

Multiple workspaces using same server causes issues #44

@torfjelde

Description

@torfjelde

I ran into an issue where autocomplete would only work for one of the workspaces but not the others. In particular it only worked for the workspace that I started the server from but not the others.

From what I can gather, this occurs because the environment is server specific rather than workspace specific (specified by the env_path field in the LanguageServer and thus does not change wrt. workspace being queried).

It's a bit unclear to me if this is the desired behavior for LanguageServer.jl and lsp-julia is doing something wrong, or if LanguageServer.jl should instead make the environment local to workspaces rather than servers.

Anyhow, I believe this can be fixed by simply dropping specification of :multi-root when registering the lsp client, i.e. remove this line: https://github.com/non-Jedi/lsp-julia/blob/c523c250c4bd2777203101ab417e9b7312472f46/lsp-julia.el#L298. This will make it so that lsp-mode creates a new server for every workspace rather than reusing the same server for all workspaces, thus allowing separate environments for different servers. Though you need to remember to delete the workspace file for lsp-mode so as to reset or remove the Julia workspaces for this change to take effect.

But even if this is actually LanguageServer.jl not providing the correct functionality, it's probably a good idea to raise an issue over there but also implement this hotfix while we wait for the bug to be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions