diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-01-27 18:26:29 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-01-27 18:26:29 +0800 |
commit | 12591b4a9b219c06f2340d9bfd6d589777bda09b (patch) | |
tree | 7054262c7edb98e4ebd1a1fb334b064c21d24c5e /script/core/completion.lua | |
parent | 8f206cfde9e41902bcf3f5314d9684d7d6cdbb29 (diff) | |
download | lua-language-server-12591b4a9b219c06f2340d9bfd6d589777bda09b.zip |
fix cache of solve
Diffstat (limited to 'script/core/completion.lua')
-rw-r--r-- | script/core/completion.lua | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua index e44e2227..dfc01391 100644 --- a/script/core/completion.lua +++ b/script/core/completion.lua @@ -554,7 +554,12 @@ local function checkFieldOfRefs(refs, ast, word, start, offset, parent, oop, res end local function checkField(ast, word, start, offset, parent, oop, results) - local refs = vm.getFields(parent, 0) + local refs + if guide.isGlobal(parent) then + refs = vm.getDefFields(parent, 0) + else + refs = vm.getFields(parent, 0) + end checkFieldOfRefs(refs, ast, word, start, offset, parent, oop, results) end @@ -1781,13 +1786,13 @@ end local function resolve(id) local item = resolveStack(id) local cache = workspace.getCache 'completion' - if cache.results then + if item and cache.results then for _, res in ipairs(cache.results) do - if res.data and res.data.id == item.data.id then + if res and res.id == id then for k, v in pairs(item) do res[k] = v end - res.data = nil + res.id = nil break end end |