From 196bad7bbd13c5423035881341a15847fad5227d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sat, 2 Nov 2019 18:08:15 +0800 Subject: =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-beta/src/searcher/eachRef.lua | 18 ++++++++++++++++++ server-beta/test/crossfile/definition.lua | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'server-beta') 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 = 1; return t', + content = 'local = 1; return ', }, { path = 'b.lua', -- cgit v1.2.3