LuaLS / LuaLS/lua-language-server
[Feature Request] Allow mark any as @enum
Open
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
Issue Description
---@enum Type
local Type = {
A = 1,
B = 2,
-- ...
}
---@return {[string]: integer}
function Generate_enum()
return {}
end
---@enum (partial) Type
local Type2 = {}
for k, v in pairs(Generate_enum()) do
Type2[k] = v
end
---@enum (partial) Type
local Type3 = Generate_enum()
The point is to achieve the same behavior for Type3 as for Type2.
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 reproducing the issue's Lua examples and inspect the language server's existing @enum handling and type inference for assignments. Compare Type2 and Type3, then add coverage so a partial enum assigned directly from Generate_enum() receives the same behavior as the incremental assignment; done means their diagnostics and type information match.
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
- 42/100