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 `

### 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 編號。

研究方向

Reproduce the issue with Runtime Path set to `?.lua;?/init.lua` by switching a git branch from `foo.lua` to `foo/init.lua`, then inspect the VS Code Problems panel for diagnostics from the previous module layout. Compare the diagnostics with the current files on disk; done means only the current module structure is analyzed after the switch.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
lua, vscode
領域
devtools
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。