Skip to content

Commit 6f2248f

Browse files
committed
add: description for @enum LuaLS#1255
1 parent 3017212 commit 6f2248f

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

locale/en-us/script.lua

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,3 +1052,30 @@ pB = -pA
10521052
```
10531053
[View Request](https://github.com/sumneko/lua-language-server/issues/599)
10541054
]=]
1055+
LUADOC_DESC_ENUM =
1056+
[=[
1057+
Mark a table as an enum. If you want an enum but can't define it as a Lua
1058+
table, take a look at the [`@alias`](https://github.com/sumneko/lua-language-server/wiki/EmmyLua-Annotations#alias)
1059+
tag.
1060+
1061+
## Syntax
1062+
`@enum <name>`
1063+
1064+
## Usage
1065+
```
1066+
---@enum colors
1067+
local colors = {
1068+
white = 0,
1069+
orange = 2,
1070+
yellow = 4,
1071+
green = 8,
1072+
black = 16,
1073+
}
1074+
1075+
---@param color colors
1076+
local function setColor(color) end
1077+
1078+
-- Completion and hover is provided for the below param
1079+
setColor(colors.green)
1080+
```
1081+
]=]

0 commit comments

Comments
 (0)