summaryrefslogtreecommitdiff
path: root/script-beta
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-19 17:12:49 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-19 17:12:49 +0800
commit59779a81ea496761270393d354743c04f925682f (patch)
tree30bff57b3ffb437773870bc3d9fbdc955d7c9ed0 /script-beta
parent7841e0365ce44419114f10927ccdf34ef0f62604 (diff)
downloadlua-language-server-59779a81ea496761270393d354743c04f925682f.zip
优化
Diffstat (limited to 'script-beta')
-rw-r--r--script-beta/core/completion.lua2
-rw-r--r--script-beta/vm/getGlobals.lua17
2 files changed, 12 insertions, 7 deletions
diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua
index 42164171..11bc4117 100644
--- a/script-beta/core/completion.lua
+++ b/script-beta/core/completion.lua
@@ -431,7 +431,7 @@ local function checkFieldOfRefs(refs, ast, word, start, offset, parent, oop, res
end
if #vm.getGlobals(key) <= 1 then
goto CONTINUE
- else
+ elseif not guide.isSet(src) then
src = vm.getGlobalSets(key)[1] or src
end
end
diff --git a/script-beta/vm/getGlobals.lua b/script-beta/vm/getGlobals.lua
index ccc86f7b..4fe95ee9 100644
--- a/script-beta/vm/getGlobals.lua
+++ b/script-beta/vm/getGlobals.lua
@@ -128,9 +128,15 @@ local function fastGetAnyGlobals()
local results = {}
local mark = {}
for uri in files.eachFile() do
- local cache = files.getCache(uri)
- cache.globals = cache.globals or getGlobalsOfFile(uri)
- for destName, sources in util.sortPairs(cache.globals) do
+ --local globalSets = getGlobalsOfFile(uri)
+ --for destName, sources in util.sortPairs(globalSets) do
+ -- if not mark[destName] then
+ -- mark[destName] = true
+ -- results[#results+1] = sources[1]
+ -- end
+ --end
+ local globals = getGlobalsOfFile(uri)
+ for destName, sources in util.sortPairs(globals) do
if not mark[destName] then
mark[destName] = true
results[#results+1] = sources[1]
@@ -145,9 +151,8 @@ local function fastGetAnyGlobalSets()
local results = {}
local mark = {}
for uri in files.eachFile() do
- local cache = files.getCache(uri)
- cache.globalSets = cache.globalSets or getGlobalSetsOfFile(uri)
- for destName, sources in util.sortPairs(cache.globalSets) do
+ local globals = getGlobalSetsOfFile(uri)
+ for destName, sources in util.sortPairs(globals) do
if not mark[destName] then
mark[destName] = true
results[#results+1] = sources[1]