Closed
Labels
feat/LuaCats AnnotationsRelated to Lua Language Server Annotations (LuaCats)feat/type checkRelated to the type checking feature
Description
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Windows
What is the issue affecting?
Type Checking, Annotations
Expected Behaviour
The fields of children in @field properties table<string, PropsClass>? when non-nil should have a tooltip with their associated field typings and comments.
Actual Behaviour
The fields of children in @field properties table<string, PropsClass>? when non-nil do not have a tooltip with their associated field typings and comments. Instead displaying as ambiguous and no highlighting to indicate a warning or error:
Reproduction steps
See [Actual Behaviour].
Additional Notes
No response
Log File
No response
Metadata
Metadata
Assignees
Labels
feat/LuaCats AnnotationsRelated to Lua Language Server Annotations (LuaCats)feat/type checkRelated to the type checking feature
Activity
carsakiller commentedon Feb 23, 2026
I am unable to replicate. Can you provide your full code snippet and annotations?
My best guess is your
didvariable is not a string and thus does not satisfytable<string, BazaarDenominationsData>, resulting indenominationsbeingnil, as defined in your annotation:My Code
Safebox36 commentedon Feb 23, 2026
It looks like you have the same scenario I got in your second screenshot, where it returns
unknownas the "type".The function looks like this if you want to try and replicate it more accurately:
Spoiler warning
tomlau10 commentedon Feb 24, 2026
This is exactly what @carsakiller trying to illustrate:
didvar isintegertype, as it is declared as the 1st iter var inipairs@field denominations table<string, BazaarDenominationData>?which requires astringkeydenominations[<string>]=>BazaarDenominationDatabut
denominations[<integer>]=>unknownMaybe you want to write the annotation as
@field denominations table<integer, BazaarDenominationData>?or even
@field denominations BazaarDenominationData[]?because it is actually anarray of BazaarDenominationData? 🤔Furthermore if it is an array, you can access the array element directly as a loop variable:
Safebox36 commentedon Feb 26, 2026
Oh I see what I've done now. My mistake.
carsakiller commentedon Feb 26, 2026
Good luck with your project!