LuaLS / lua-language-server

A language server that offers Lua language support - programmed in Lua
https://luals.github.io
MIT License
3.29k stars 305 forks source link

Allow mark any as @enum #2819

Closed d-enk closed 1 month ago

d-enk commented 1 month ago

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()

image

image

The point is to achieve the same behavior for Type3 as for Type2.