diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-03-03 20:20:29 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-03-03 20:20:29 +0800 |
commit | b3973077759549aaedecc02d2443bdfdf029b329 (patch) | |
tree | 18db79bbc91ad91a7ded3e44d0babc85886c4b1c /script/core | |
parent | 69a3aeb91361b49f54de0bf6d623c78aa59da550 (diff) | |
download | lua-language-server-b3973077759549aaedecc02d2443bdfdf029b329.zip |
fix #438 should check globals
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/completion.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua index 96115471..407a0e98 100644 --- a/script/core/completion.lua +++ b/script/core/completion.lua @@ -359,7 +359,7 @@ local function checkLocal(ast, word, offset, results) end local function checkModule(ast, word, offset, results) - local locals = guide.getVisibleLocals(ast.ast, offset) + local locals = guide.getVisibleLocals(ast.ast, offset) for uri in files.eachFile() do if files.eq(uri, guide.getUri(ast.ast)) then goto CONTINUE @@ -368,7 +368,9 @@ local function checkModule(ast, word, offset, results) local path = furi.decode(originUri) local fileName = path:match '[^/\\]*$' local stemName = fileName:gsub('%..+', '') - if not locals[stemName] + if not locals[stemName] + and #vm.getGlobalSets(stemName) == 0 + and not config.config.diagnostics.globals[stemName] and stemName:match '^[%a_][%w_]*$' and matchKey(word, stemName) then local targetAst = files.getAst(uri) |