You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to document @field values (description not shown when hovering the function) #3373
The syntax is this one: ---@field [scope] <name[?]> <type> [description]
A bit sad that the description has to come after the field and can not be above it. If the type is already a long callback the entire annotation line with long description will be super long :(
Anyways even that one I could not get to work. My editor would not show the description when hovering the function. Also I could not go to its definition to at least manually browse the type annotations.
changed the title [-]How to document @field values[/-][+]How to document @field values (description not shown when hovering the function)[/+]on Mar 10, 2026
Oh nice catch with it working as local. Sadly I can not use this workaround :/ because the type annotation comes from a meta file and is defined in C++ so without the global definition the instance of the table would not be in scope at all as far as I understand.
Dropping by again to say that I found a workaround. Define the class first and then set the instance's @type:
Code
---@classActor---A table that maps a MIME type to a serialization function.------Each serialization function must accept `Actor` as a parameter and return---a string representation of it.---@fieldserializerstable<string, fun(v: Actor): string>---Execute the given action. A success boolean and error message will be returned------See some documentation about it---@fieldexecutefun(action: string): boolean, string---@typeActormyActor= {}
Activity
[-]How to document @field values[/-][+]How to document @field values (description not shown when hovering the function)[/+]carsakiller commentedon Mar 10, 2026
Interestingly enough, if the table is made local, it works as expected:
Once it is made global, the description disappears:
As for defining functions in a
@field, there are various known limitations that could hopefully be fixed with a@functionannotation.ChillerDragon commentedon Mar 11, 2026
Oh nice catch with it working as local. Sadly I can not use this workaround :/ because the type annotation comes from a meta file and is defined in C++ so without the global definition the instance of the table would not be in scope at all as far as I understand.
carsakiller commentedon Mar 18, 2026
Dropping by again to say that I found a workaround. Define the class first and then set the instance's
@type:Code
carsakiller commentedon Mar 18, 2026
Also, it looks like this issue of fields not being accessible on globals has already been reported, so I'm going to mark this as a duplicate.
ChillerDragon commentedon Mar 18, 2026
Thanks for another workaround c:
Sadly it did not work at all for me and made everything worse xd. Maybe because its in a meta file. Anyways I will survive.