LuaLS / LuaLS/lua-language-server
Non-deterministic behavior when there are multiple parent folders with .luarc.json.
还没有人认领这个 Issue。
- 主要语言
- Lua
- 星标
- 4.4k
- 派生
- 442
- PR 合并指标
- 30 天内没有已合并 PR
描述
How are you using the lua-language-server?
NeoVim
Which OS are you using?
Linux
What is the issue affecting?
Diagnostics/Syntax Checking
Expected Behaviour
When the language server processes a Lua file, it should use the .luarc.json file that is closest (in the chain of parent folders) to the file being opened. So in this case:
dir1
|- .luarc.json
\_ dir2
|- .luarc.json
\_ code.lua
Opening code.lua should use dir2/.luarc.json.
Actual Behaviour
Non-deterministic behavior: sometimes it uses dir1/.luarc.json and sometimes it uses dir2/.luarc.json. This is a big problem e.g. in cases where those two files specify different versions of Lua.
Reproduction steps
Create the directory/file structure above, specifying different version of Lua in each one, then put some code in code.lua that is sensitive to the version, then run lua-language-server (I run it through Neovim) on code.lua, and observe sometimes it assumes one version of Lua and other times it uses the other.
Deleting dir1/.luarc.json then eliminates the non-deterministic behavior and it always uses dir2/.luarc.json.
Additional Notes
No response
Log File
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,使用两个 .luarc.json 文件复现目录结构,并通过 Neovim 打开 code.lua。跟踪 lua-language-server 如何发现配置文件,并比较配置了不同 Lua 版本时的重复运行结果。当最近的父级目录配置能够始终一致地被选中,且复现不再显示非确定性诊断时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- lua
- 领域
- devtools
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100