diff options
author | xuhuanzy <501417909@qq.com> | 2024-08-18 14:41:32 +0800 |
---|---|---|
committer | xuhuanzy <501417909@qq.com> | 2024-08-18 14:41:32 +0800 |
commit | 2e8a8db31615db610658d74c5c2f29f30d30073b (patch) | |
tree | 973ad99e5e50279f147fa5931938989a816bbf72 | |
parent | d702a55715df19a219e963da496e6fb76db0aacd (diff) | |
download | lua-language-server-2e8a8db31615db610658d74c5c2f29f30d30073b.zip |
`enum`具有`partial`时会提示所有同`enum`字段而不是只提示当前表的字段.
-rw-r--r-- | script/vm/compiler.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index 54390450..e0cb54c7 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -189,6 +189,41 @@ local searchFieldSwitch = util.switch() end end end + local docs = source.bindDocs + if docs then + for _, doc in ipairs(docs) do + if doc.type == 'doc.enum' then + if not vm.docHasAttr(doc, 'partial') then + return + end + for _, def in ipairs(vm.getDefs(doc)) do + if def.type ~= 'doc.enum' then + goto CONTINUE + end + local tbl = def.bindSource + if not tbl then + return + end + for _, field in ipairs(tbl) do + if field.type == 'tablefield' + or field.type == 'tableindex' then + if not field.value then + goto CONTINUE + end + local fieldKey = guide.getKeyName(field) + if key == vm.ANY + or key == fieldKey then + hasFiled = true + pushResult(field) + end + ::CONTINUE:: + end + end + ::CONTINUE:: + end + end + end + end end) : case 'string' : case 'doc.type.string' |