summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script-beta/core/completion.lua2
-rw-r--r--script-beta/vm/getGlobals.lua17
-rw-r--r--test-beta/crossfile/references.lua17
3 files changed, 29 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]
diff --git a/test-beta/crossfile/references.lua b/test-beta/crossfile/references.lua
index a0e34cfd..66abd4e3 100644
--- a/test-beta/crossfile/references.lua
+++ b/test-beta/crossfile/references.lua
@@ -394,3 +394,20 @@ TEST {
]]
},
}
+
+TEST {
+ {
+ path = 'a.lua',
+ content = [[
+ local <?t?> = require 'b'
+ return <!t!>
+ ]]
+ },
+ {
+ path = 'b.lua',
+ content = [[
+ local <!t!> = require 'a'
+ return <!t!>
+ ]]
+ },
+}