Skip to content

Adding a new workspace folder breaks things #1974

Open
@musjj

Description

@musjj

How are you using the lua-language-server?

NeoVim

Which OS are you using?

Windows

What is the issue affecting?

Completion, Diagnostics/Syntax Checking, Hover, Libraries

Expected Behaviour

Addding new workspace folders should not break anything.

Actual Behaviour

Right now, adding a new workspace folder breaks two things, diagnostics and require statements:

  • You can fix the diagnostic errors by hooking to the workspace/diagnostic/refresh handler to manually refresh it, but even then this is very unreliable and prone to not working:
    sumneko_lua doesn't work across multiple projects neovim/nvim-lspconfig#2366

  • require statements that refers to modules in the new workspace folder also does not resolve correctly (hovering over the module string will display the byte length, instead of the resolved path). This means that completions from the required module will also be missing. So far I can't find any way to fix this without restarting neovim entirely.

Other LSP servers doesn't have this problem. Adding a new workspace folder should just work without any additional steps.

Reproduction steps

  1. Initialize the LSP server with a root directory
  2. Add a new workspace folder using workspace/didChangeWorkspaceFolders
  3. Opening a file from that workspace folder results in diagnostic errors and modules not being resolved correctly

Additional Notes

No response

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Info NeededMore information is requiredbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions