LuaLS / LuaLS/lua-language-server
Support specifying globals inside Lua files
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
Currently, when using this language server, you get warnings for global variables:
if someGlobalVariable then -- Undefined global `someGlobalVariable `. Lua Diagnostics.(undefined-global)
print("wow!")
end
The way to squelch them is to add the globals to the VSCode settings. But this is too much of a sledgehammer, as we might only want the globals to be enabled in this specific file. Thus, we should also add a feature so that end-users can specify the globals in-line:
-- We specify a list of globals at the top of the file.
-- @global someGlobalVariable
someCode()
if someGlobalVariable then -- No warning.
print("wow!")
end
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
Start by locating the undefined-global diagnostic handling and the existing VSCode global-variable setting in the language server. Trace how Lua comments are parsed, then define and test the inline @global syntax so the named global is accepted only in that file without changing project-wide settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100