File tree Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 12
12
* ` CHG ` completion: can be triggered in ` LuaDoc ` and strings
13
13
* ` CHG ` diagnostic: smoother
14
14
* ` CHG ` settings ` Lua.color.mode ` removed
15
+ * ` FIX ` [ #876 ] ( https://github.com/sumneko/lua-language-server/issues/876 )
15
16
* ` FIX ` [ #879 ] ( https://github.com/sumneko/lua-language-server/issues/879 )
16
17
* ` FIX ` [ #884 ] ( https://github.com/sumneko/lua-language-server/issues/884 )
17
18
* ` FIX ` [ #885 ] ( https://github.com/sumneko/lua-language-server/issues/885 )
Original file line number Diff line number Diff line change @@ -122,12 +122,24 @@ local function getOptionalMap(fields)
122
122
if field .type == ' doc.field.name' then
123
123
if field .parent .optional then
124
124
local key = vm .getKeyName (field )
125
+ local tp = vm .getKeyType (field )
126
+ if tp == ' number' or tp == ' integer' then
127
+ key = tonumber (key )
128
+ elseif tp == ' boolean' then
129
+ key = key == ' true'
130
+ end
125
131
optionals [key ] = true
126
132
end
127
133
end
128
134
if field .type == ' doc.type.field' then
129
135
if field .optional then
130
136
local key = vm .getKeyName (field )
137
+ local tp = vm .getKeyType (field )
138
+ if tp == ' number' or tp == ' integer' then
139
+ key = tonumber (key )
140
+ elseif tp == ' boolean' then
141
+ key = key == ' true'
142
+ end
131
143
optionals [key ] = true
132
144
end
133
145
end
Original file line number Diff line number Diff line change @@ -1644,6 +1644,7 @@ TEST [[
1644
1644
---@field x number
1645
1645
---@field y number
1646
1646
---@field z? number
1647
+ ---@field [3]? number
1647
1648
local <?t?>
1648
1649
1649
1650
t.z = any
@@ -1653,6 +1654,7 @@ local t: Position {
1653
1654
x: number,
1654
1655
y: number,
1655
1656
z?: number,
1657
+ [3]?: number,
1656
1658
}
1657
1659
]]
1658
1660
You can’t perform that action at this time.
0 commit comments