From 2c07a7a12bf840e1a90abc117fd5e69866f76fdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 19 Nov 2020 15:10:07 +0800 Subject: =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=AE=8C=E6=88=90=E5=92=8C=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E5=8F=98=E9=87=8F=E7=9B=B8=E5=85=B3=E7=9A=84=E4=B8=80?= =?UTF-8?q?=E4=BA=9Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-beta/core/completion.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'script-beta/core') 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 -- cgit v1.2.3