-
-
Notifications
You must be signed in to change notification settings - Fork 375
Open
Description
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Linux
What is the issue affecting?
Annotations, Hover
Expected Behaviour
On hover over action
param in my function I'd like to get annotation consistent with already existing annotation that i get if i hover over all
in actions.all
:
(field) actions.all: {
[10]: string = "supportAttack",
[11]: string = "supportDefence",
[12]: string = "supportBoth",
[13]: string = "supportAttackPike",
[14]: string = "supportDefencePike",
[15]: string = "stanceShieldwall",
[16]: string = "stanceLastman",
[17]: string = "stanceBarrage",
[18]: string = "encamp",
[19]: string = "uncamp",
[1]: string = "retreat",
[20]: string = "destroyCamp",
[21]: string = "buildFort",
[22]: string = "demountFort",
[23]: string = "destroyFort",
[24]: string = "rest",
[25]: string = "respire",
[2]: string = "move",
[3]: string = "swap",
[4]: string = "forcedMove",
[5]: string = "melee",
[6]: string = "shoot",
[7]: string = "shoot2",
[8]: string = "breakthrough",
[9]: string = "enclosing",
}
Essentially i'd like enum for this array to give the same behavioir as alias like this
---@alias Action
---| '"retreat"'
---| '"move"
---| '"swap"'
---| '"forcedMove"'
---| '"melee"'
---| '"shoot"'
---| '"shoot2"'
---| '"breakthrough"
---| '"enclosing"'
---| '"supportAttack"'
---| '"supportDefence"'
---| '"supportBoth"'
---| '"supportAttackPike"'
---| '"supportDefencePike"'
---| '"stanceShieldwall"'
---| '"stanceLastman"'
---| '"stanceBarrage"'
---| '"encamp"'
---| '"uncamp"'
---| '"destroyCamp"'
---| '"buildFort"'
---| '"demountFort"'
---| '"destroyFort"'
---| '"rest"'
---| '"respire"'
Actual Behaviour
On hover over action
param in my function I get this annotation:
(parameter) action: Action
{
}
Reproduction steps
Consider this minimal code snippet:
local actions = {}
---@enum Action
actions.all = {
"retreat",
"move",
"swap",
"forcedMove",
"melee",
"shoot",
"shoot2",
"breakthrough",
"enclosing",
"supportAttack",
"supportDefence",
"supportBoth",
"supportAttackPike",
"supportDefencePike",
"stanceShieldwall",
"stanceLastman",
"stanceBarrage",
"encamp",
"uncamp",
"destroyCamp",
"buildFort",
"demountFort",
"destroyFort",
"rest",
"respire",
}
actions.isStance = {stanceShieldwall = true, stanceLastman = true, stanceBarrage = true}
--- @param action Action
--- @return boolean
function actions.IsStance(action)
return actions.isStance[action]
end
Additional Notes
No response
Log File
No response
Metadata
Metadata
Assignees
Labels
No labels