diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-18 18:40:10 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-18 18:40:10 +0800 |
commit | 34bda3431ecef5fe318d3f9761134db24f9813d2 (patch) | |
tree | 82f42d4ee824789979c99c73a16b4ef1f9900170 | |
parent | f170f8d14a8d607db9cc9447c6e562c0649817fd (diff) | |
download | lua-language-server-34bda3431ecef5fe318d3f9761134db24f9813d2.zip |
修正一个bug
-rw-r--r-- | script-beta/core/completion.lua | 6 | ||||
-rw-r--r-- | test-beta/completion/init.lua | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua index a1a35a92..840d4cd7 100644 --- a/script-beta/core/completion.lua +++ b/script-beta/core/completion.lua @@ -434,7 +434,11 @@ local function checkFieldOfRefs(refs, ast, word, start, offset, parent, oop, res goto CONTINUE end if isSameSource(ast, src, start) then - goto CONTINUE + -- 由于fastGlobal的优化,全局变量只会找出一个值,有可能找出自己 + -- 所以遇到自己的时候重新找一下有没有其他定义 + if #vm.getRefs(src) <= 1 then + goto CONTINUE + end end local name = key:sub(3) if locals and locals[name] then diff --git a/test-beta/completion/init.lua b/test-beta/completion/init.lua index a37ca753..7d1ca368 100644 --- a/test-beta/completion/init.lua +++ b/test-beta/completion/init.lua @@ -1201,6 +1201,11 @@ io$ (EXISTS) TEST [[ +loadfile$ +]] +(EXISTS) + +TEST [[ debug.setcsta$ ]] { |