diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-07-25 15:47:53 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-07-25 15:47:53 +0800 |
commit | 10f43c44172fc9adc4f6f73a46da250c8c436279 (patch) | |
tree | c1d82a2d02bf307629aa2a845099a08c21d609f0 /script-beta | |
parent | cc6236c6803103212b17dadb3014739509a14d31 (diff) | |
download | lua-language-server-10f43c44172fc9adc4f6f73a46da250c8c436279.zip |
修正bug
Diffstat (limited to 'script-beta')
-rw-r--r-- | script-beta/core/diagnostics/undefined-global.lua | 2 | ||||
-rw-r--r-- | script-beta/vm/getGlobals.lua | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/script-beta/core/diagnostics/undefined-global.lua b/script-beta/core/diagnostics/undefined-global.lua index 3a9aa554..6b78225c 100644 --- a/script-beta/core/diagnostics/undefined-global.lua +++ b/script-beta/core/diagnostics/undefined-global.lua @@ -19,7 +19,7 @@ return function (uri, callback) return end if globalCache[key] == nil then - local defs = guide.requestDefinition(src) + local defs = vm.getDefs(src) -- 这里要处理跨文件的情况 globalCache[key] = #defs > 0 end diff --git a/script-beta/vm/getGlobals.lua b/script-beta/vm/getGlobals.lua index adc6c9fc..53fff173 100644 --- a/script-beta/vm/getGlobals.lua +++ b/script-beta/vm/getGlobals.lua @@ -12,10 +12,12 @@ local function getGlobalsOfFile(uri) local results = guide.requestFields(env) for _, res in ipairs(results) do local name = guide.getSimpleName(res) - if not globals[name] then - globals[name] = {} + if name then + if not globals[name] then + globals[name] = {} + end + globals[name][#globals[name]+1] = res end - globals[name][#globals[name]+1] = res end return globals end |