summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-08-12 14:40:57 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-08-12 14:40:57 +0800
commit93460788ba915bed17f15982036563bc75b1e274 (patch)
tree5c35231dcb3b40718d577d8cf4488149b3a0cb8e
parent0e4da86a34a4162b2d094390e1dc3a6d89f3e7e9 (diff)
downloadlua-language-server-93460788ba915bed17f15982036563bc75b1e274.zip
整理代码
-rw-r--r--script-beta/core/reference.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/script-beta/core/reference.lua b/script-beta/core/reference.lua
index 5c18de1b..e61e2940 100644
--- a/script-beta/core/reference.lua
+++ b/script-beta/core/reference.lua
@@ -1,5 +1,6 @@
local guide = require 'parser.guide'
local files = require 'files'
+local vm = require 'vm'
local findSource = require 'core.find-source'
local function isValidFunction(source, offset)
@@ -56,8 +57,7 @@ return function (uri, offset)
end
local results = {}
- local refs = guide.requestReference(source)
- for _, src in ipairs(refs) do
+ vm.eachRef(source, function (src)
local root = guide.getRoot(src)
if src.type == 'setfield'
or src.type == 'getfield'
@@ -75,7 +75,7 @@ return function (uri, offset)
target = src,
uri = files.getOriginUri(root.uri),
}
- end
+ end)
if #results == 0 then
return nil