summaryrefslogtreecommitdiff
path: root/server-beta
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-11-02 18:08:15 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-11-02 18:08:15 +0800
commit196bad7bbd13c5423035881341a15847fad5227d (patch)
tree9b04db712f5a803aa0a4778305df05b92c1a1488 /server-beta
parent4acd712def70f0e119e41eb8c1011f6796739de9 (diff)
downloadlua-language-server-196bad7bbd13c5423035881341a15847fad5227d.zip
暂存
Diffstat (limited to 'server-beta')
-rw-r--r--server-beta/src/searcher/eachRef.lua18
-rw-r--r--server-beta/test/crossfile/definition.lua2
2 files changed, 19 insertions, 1 deletions
diff --git a/server-beta/src/searcher/eachRef.lua b/server-beta/src/searcher/eachRef.lua
index 91acb403..05788eb0 100644
--- a/server-beta/src/searcher/eachRef.lua
+++ b/server-beta/src/searcher/eachRef.lua
@@ -1,4 +1,6 @@
local guide = require 'parser.guide'
+local files = require 'files'
+local workspace = require 'workspace'
local function ofCall(searcher, func, index, callback)
searcher:eachRef(func, function (info)
@@ -40,6 +42,22 @@ local function ofSpecialCall(searcher, call, func, index, callback)
end)
end
end
+ elseif name == 'require' then
+ if index == 1 then
+ local args = call.args
+ if args[1] then
+ local literal = guide.getLiteral(args[1])
+ if type(literal) == 'string' then
+ local result = workspace.findUrisByRequirePath(literal, true)
+ for _, uri in ipairs(result) do
+ local ast = files.getAst(uri)
+ if ast then
+ local other = files.getSearcher(uri)
+ end
+ end
+ end
+ end
+ end
end
end
diff --git a/server-beta/test/crossfile/definition.lua b/server-beta/test/crossfile/definition.lua
index cf54f30e..7dd70278 100644
--- a/server-beta/test/crossfile/definition.lua
+++ b/server-beta/test/crossfile/definition.lua
@@ -108,7 +108,7 @@ TEST {
TEST {
{
path = 'a.lua',
- content = 'local <!t!> = 1; return t',
+ content = 'local <!t!> = 1; return <!t!>',
},
{
path = 'b.lua',