diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-11-23 15:43:06 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-11-23 15:43:06 +0800 |
commit | 1c0753f54ae77d560ae6cdb232cec8383fafce92 (patch) | |
tree | 3f1e19fcfd4c3f56479456114aeb1503f192d30c /script/core/completion | |
parent | 2b6cd724633edad4ce3b8d1928d9be31104911ba (diff) | |
download | lua-language-server-1c0753f54ae77d560ae6cdb232cec8383fafce92.zip |
fix #1717
Diffstat (limited to 'script/core/completion')
-rw-r--r-- | script/core/completion/completion.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua index bd7c756f..e63e8d35 100644 --- a/script/core/completion/completion.lua +++ b/script/core/completion/completion.lua @@ -1235,7 +1235,13 @@ end ---@param src vm.node.object ---@param enums table[] ---@param isInArray boolean? -local function insertEnum(state, pos, src, enums, isInArray) +---@param mark table? +local function insertEnum(state, pos, src, enums, isInArray, mark) + mark = mark or {} + if mark[src] then + return + end + mark[src] = true if src.type == 'doc.type.string' or src.type == 'doc.type.integer' or src.type == 'doc.type.boolean' then @@ -1273,7 +1279,7 @@ local function insertEnum(state, pos, src, enums, isInArray) } elseif isInArray and src.type == 'doc.type.array' then for i, d in ipairs(vm.getDefs(src.node)) do - insertEnum(state, pos, d, enums, isInArray) + insertEnum(state, pos, d, enums, isInArray, mark) end elseif src.type == 'global' and src.cate == 'type' then for _, set in ipairs(src:getSets(state.uri)) do |