Skip to content

Commit 1c0753f

Browse files
committed
fix #1717
1 parent 2b6cd72 commit 1c0753f

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
```
1616
* `FIX` [#1698]
1717
* `FIX` [#1704]
18+
* `FIX` [#1717]
1819

1920
[#1698]: https://github.com/sumneko/lua-language-server/issues/1698
2021
[#1704]: https://github.com/sumneko/lua-language-server/issues/1704
22+
[#1717]: https://github.com/sumneko/lua-language-server/issues/1717
2123

2224
## 3.6.3
2325
`2022-11-14`

script/core/completion/completion.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,13 @@ end
12351235
---@param src vm.node.object
12361236
---@param enums table[]
12371237
---@param isInArray boolean?
1238-
local function insertEnum(state, pos, src, enums, isInArray)
1238+
---@param mark table?
1239+
local function insertEnum(state, pos, src, enums, isInArray, mark)
1240+
mark = mark or {}
1241+
if mark[src] then
1242+
return
1243+
end
1244+
mark[src] = true
12391245
if src.type == 'doc.type.string'
12401246
or src.type == 'doc.type.integer'
12411247
or src.type == 'doc.type.boolean' then
@@ -1273,7 +1279,7 @@ local function insertEnum(state, pos, src, enums, isInArray)
12731279
}
12741280
elseif isInArray and src.type == 'doc.type.array' then
12751281
for i, d in ipairs(vm.getDefs(src.node)) do
1276-
insertEnum(state, pos, d, enums, isInArray)
1282+
insertEnum(state, pos, d, enums, isInArray, mark)
12771283
end
12781284
elseif src.type == 'global' and src.cate == 'type' then
12791285
for _, set in ipairs(src:getSets(state.uri)) do

test/completion/common.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4076,3 +4076,11 @@ f {<??>}
40764076
kind = define.CompletionItemKind.Property,
40774077
},
40784078
}
4079+
4080+
TEST [[
4081+
---@alias Foo Foo[]
4082+
---@type Foo
4083+
local foo
4084+
foo = {"<??>"}
4085+
]]
4086+
(EXISTS)

0 commit comments

Comments
 (0)