diff options
Diffstat (limited to 'script-beta')
-rw-r--r-- | script-beta/core/completion.lua | 12 | ||||
-rw-r--r-- | script-beta/parser/guide.lua | 6 |
2 files changed, 15 insertions, 3 deletions
diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua index 479d6ab4..610279db 100644 --- a/script-beta/core/completion.lua +++ b/script-beta/core/completion.lua @@ -425,6 +425,9 @@ local function checkFieldOfRefs(refs, ast, word, start, offset, parent, oop, res if isSameSource(ast, src, start) then -- 由于fastGlobal的优化,全局变量只会找出一个值,有可能找出自己 -- 所以遇到自己的时候重新找一下有没有其他定义 + if not guide.isGlobal(src) then + goto CONTINUE + end if #vm.getGlobals(key) <= 1 then goto CONTINUE end @@ -438,14 +441,19 @@ local function checkFieldOfRefs(refs, ast, word, start, offset, parent, oop, res end local last = fields[name] if not last then - fields[name] = src + if guide.isGlobal(src) then + fields[name] = vm.getDefs(src, 'deep')[1] or src + else + fields[name] = src + end goto CONTINUE end if src.type == 'tablefield' or src.type == 'setfield' or src.type == 'tableindex' or src.type == 'setindex' - or src.type == 'setmethod' then + or src.type == 'setmethod' + or src.type == 'setglobal' then fields[name] = src goto CONTINUE end diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 3cbdf4d8..1de15a3b 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -1215,7 +1215,11 @@ function m.isGlobal(source) end end if source.type == 'field' then - local node = source.parent.node + source = source.parent + end + if source.type == 'getfield' + or source.type == 'setfield' then + local node = source.node if node and node.special == '_G' then return true end |