diff options
author | Kevin Hahn <hahn.kev@gmail.com> | 2022-06-23 22:25:30 +0700 |
---|---|---|
committer | Kevin Hahn <hahn.kev@gmail.com> | 2022-06-27 14:14:31 +0700 |
commit | eb6165ea4cafe386d8aa38f7ad33a40e14d404fe (patch) | |
tree | 55c4ff0692fb5e0dc5253ab6b2089a1d5a7128cf /script/vm | |
parent | 0db0e59ea3649d5be702b977073b5418c1d3b8ce (diff) | |
download | lua-language-server-eb6165ea4cafe386d8aa38f7ad33a40e14d404fe.zip |
enable autocomplete of array enum
Diffstat (limited to 'script/vm')
-rw-r--r-- | script/vm/compiler.lua | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index ad3295f7..d0063d00 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -805,7 +805,7 @@ local function isValidCallArgNode(source, node) return node.type == 'doc.type.function' end if source.type == 'table' then - return node.type == 'doc.type.table' + return node.type == 'doc.type.table' or node.type == 'doc.type.array' or ( node.type == 'global' and node.cate == 'type' ---@cast node vm.global @@ -1274,6 +1274,7 @@ local compilerSwitch = util.switch() or source.parent.type == 'setlocal' or source.parent.type == 'tablefield' or source.parent.type == 'tableindex' + or source.parent.type == 'tableexp' or source.parent.type == 'setfield' or source.parent.type == 'setindex' then local parentNode = vm.compileNode(source.parent) @@ -1490,6 +1491,18 @@ local compilerSwitch = util.switch() end) : case 'tableexp' : call(function (source) + if (source.parent.type == 'table') then + local node = vm.compileNode(source.parent) + for n in node:eachObject() do + if (n.type == 'global' + and n.cate == 'type') then + vm.setNode(source, vm.compileNode(n)) + elseif n.type == 'doc.type.array' then + vm.setNode(source, vm.compileNode(n.node)) + end + end + return + end vm.setNode(source, vm.compileNode(source.value)) end) : case 'function.return' |