LuaLS / LuaLS/lua-language-server
Global in one file affects diagnostics in another
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?
Windows
What is the issue affecting?
Diagnostics/Syntax Checking
Expected Behaviour
If I have 1.lua:
function Main()
foobar = 1
end
and 2.lua:
function Main()
print(foobar)
end
in the same workspace/directory.
I would expect 2.lua to show foobar as undefined (unless I explicitly require 1.lua)
Actual Behaviour
No error is shown.
Additional Notes
This might be a pecularity of how I'm using lua (each file defines a separate plugin) but I would be surprised if this is an uncommon usage pattern. At the very least there should be a way to configure the behaviour.
Also - I'd be curious to understand the thinking behind the existing behaviour?
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 example in the Visual Studio Code extension with 1.lua and 2.lua in the same workspace, then trace how the language server shares globals between files. Determine how explicit require usage should affect diagnostics and whether a configuration option is needed. Done means 2.lua reports foobar as undefined unless 1.lua is explicitly required.
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
- 30/100