diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-19 14:35:55 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-19 14:35:55 +0800 |
commit | ca1d649bab3431377684233724a66295aedf983b (patch) | |
tree | 7307e0eef68b4431ae1618aa301e63ed48fd33ad /script-beta | |
parent | 7ca5c199bb4689528107e4f71382bc8baf71cba7 (diff) | |
download | lua-language-server-ca1d649bab3431377684233724a66295aedf983b.zip |
修正一个bug
Diffstat (limited to 'script-beta')
-rw-r--r-- | script-beta/core/completion.lua | 4 | ||||
-rw-r--r-- | script-beta/vm/getGlobals.lua | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua index 8ff374b7..1a7267ce 100644 --- a/script-beta/core/completion.lua +++ b/script-beta/core/completion.lua @@ -442,14 +442,14 @@ local function checkFieldOfRefs(refs, ast, word, start, offset, parent, oop, res if not key or key:sub(1, 1) ~= 's' then goto CONTINUE end - local name = key:sub(3) if isSameSource(ast, src, start) then -- 由于fastGlobal的优化,全局变量只会找出一个值,有可能找出自己 -- 所以遇到自己的时候重新找一下有没有其他定义 - if #vm.getGlobals(name) <= 1 then + if #vm.getGlobals(key) <= 1 then goto CONTINUE end end + local name = key:sub(3) if locals and locals[name] then goto CONTINUE end diff --git a/script-beta/vm/getGlobals.lua b/script-beta/vm/getGlobals.lua index 4c0abe3d..9d51ec31 100644 --- a/script-beta/vm/getGlobals.lua +++ b/script-beta/vm/getGlobals.lua @@ -83,16 +83,16 @@ local function getAnyGlobalsFast() return results end -function vm.getGlobals(name) - if name == '*' and config.config.intelliSense.fastGlobal then +function vm.getGlobals(key) + if key == '*' and config.config.intelliSense.fastGlobal then return getAnyGlobalsFast() end - local cache = vm.getCache('getGlobals')[name] + local cache = vm.getCache('getGlobals')[key] if cache ~= nil then return cache end - cache = getGlobals(name) - vm.getCache('getGlobals')[name] = cache + cache = getGlobals(key) + vm.getCache('getGlobals')[key] = cache return cache end |