LuaLS / LuaLS/lua-language-server

Diagnostics can become stale when switching between `<module>.lua` and `<module>/init.lua` structures (such as when going back and forth between git branches)

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

还没有人认领这个 Issue。

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

描述

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Linux

What is the issue affecting?

Diagnostics/Syntax Checking

Expected Behaviour

Diagnostics should always be performed on the current version of a module that is on disk.

Actual Behaviour

When switching between two different ways of structuring the same module as described in the title, diagnostics can populate the Problems panel in VS Code with information about the version of the module that was on-disk before switching using a mechanism such as git checkout <branch>

Reproduction steps
  1. Make sure Runtime Path includes ?.lua;?/init.lua
  2. Create a module at foo.lua, populate it with working Lua code.
  3. Create a new git branch
  4. Refactor foo.lua to foo/init.lua
  5. Various diagnostics will show up in the VS Code Problems Panel, such as duplicate definitions, missing annotations, etc. It almost looks like the LSP is trying to process both files at the same time.
Additional Notes

No response

Log File

I won't be able to provide logs as this is a proprietary codebase. Apologies.

贡献指南

打开贡献指南

从这里开始

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

调研方向

将 Runtime Path 设置为 ?.lua;?/init.lua,把 git 分支从 foo.lua 切换到 foo/init.lua,以复现该问题,然后检查 VS Code Problems 面板中来自之前模块布局的诊断信息。将这些诊断信息与磁盘上的当前文件进行比较;切换后仅分析当前模块结构即表示完成。

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

评估

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

把新 issue 发到你的邮箱

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