LuaLS / LuaLS/lua-language-server

Adding a new workspace folder breaks things

未关闭
#1,974 10 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug Info Needed
主要语言
Lua
星标
4.4k
派生
442
PR 合并指标
30 天内没有已合并 PR

描述

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:
    https://github.com/neovim/nvim-lspconfig/issues/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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先重现报告的操作序列:使用根目录进行初始化,发送 workspace/didChangeWorkspaceFolders,并打开添加文件夹中的一个文件。随后调查 workspace/diagnostic/refresh 和 require 模块解析的行为。完成的标准是:在新的 workspace 中,diagnostics、悬停路径和 completions 均能正常工作,而无需重启 Neovim 或依赖手动刷新。

由索引模型根据 Issue 内容生成。

评估

技术栈
lua, neovim
领域
devtools
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。