-
-
Notifications
You must be signed in to change notification settings - Fork 391
Open
Description
Request: Allow adding a field type to tables and enum definitions using the @field annotation.
This is useful for generating meta files from C code where there is no Lua table literal to copy.
See current behaviour below:
@class
✅ Using @field
---@class Foo
---@field myField 5
Foo = {}✅ Using literal code
---@class Foo
Foo = {
myField = 5,
}✅ Using type annotation
---@class Foo
Foo = {
---@type 5
myField = nil,
}@enum
❌ Using field
---@enum Foo
---@field myField 5
Foo = {}Error: The field must be defined after the class.Lua Diagnostics.(doc-field-no-class)
✅ Using literal code
---@enum Foo
Foo = {
myField = 5,
}✅ Using type annotation
---@enum Foo
Foo = {
---@type 5
myField = nil,
}Untyped table
❌ Using field
---@field myField 5
Foo = {}Error: The field must be defined after the class.Lua Diagnostics.(doc-field-no-class)
✅ Using literal code
Foo = {
myField = 5,
}✅ Using type annotation
Foo = {
---@type 5
myField = nil,
}Metadata
Metadata
Assignees
Labels
No labels