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)
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
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
- Make sure
Runtime Pathincludes?.lua;?/init.lua - Create a module at
foo.lua, populate it with working Lua code. - Create a new
gitbranch - Refactor
foo.luatofoo/init.lua - 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
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.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, vscode
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100