Is there support for possible values for fields? #1658
-
Hi, im using the @alias annotation to get the possible values for my functions. This works as shown in the wiki: --- @alias side
--- | '"left"' # The left side of the device
--- | '"right"' # The right side of the device
--- | '"top"' # The top side of the device
--- | '"bottom"' # The bottom side of the device
--- | '"front"' # The front side of the device
--- | '"back"' # The back side of the device
--- @param side side The side ...
--- @return void
function item.test(side) end Now I have inside a class some fields like:
This field can be set to an array of spawnpool names like ["room","chest", ...]. I would like to achive that the modder can see which pools are avaiable for this field. Is this currently possible with the lua language server? I tried already @alias and @enum but none of them seems to be working. I suspect that this is because the language server should only give suggestions after the = and that this is fundamentally different from the function parameters for which the aliases work. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello! Yes, it is supported. The issue you are having is due to specifying ---@alias spawnOptions
--- | '"room"'
--- | '"chest"'
--- | '"origin"'
---@class item
---@field spawnsin spawnOptions Where the item should spawn
local item = {} The syntax you are using is not yet supported, but is being added for |
Beta Was this translation helpful? Give feedback.
Hello!
Yes, it is supported. The issue you are having is due to specifying
public
for the field. By default, they are treated as public. Doing the following works for me:The syntax you are using is not yet supported, but is being added for
v3.6
.