From da08423453d5b2e0c60fbee50b86ce1a7e03ba82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 4 Nov 2019 11:00:30 +0800 Subject: =?UTF-8?q?=E6=94=AF=E6=8C=81=20uri?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-beta/src/core/definition.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'server-beta/src/core') diff --git a/server-beta/src/core/definition.lua b/server-beta/src/core/definition.lua index 30ce5dec..1c2adf3e 100644 --- a/server-beta/src/core/definition.lua +++ b/server-beta/src/core/definition.lua @@ -3,7 +3,7 @@ local workspace = require 'workspace' local files = require 'files' local searcher = require 'searcher' -local function findDef(sch, source, callback) +local function findDef(source, callback) if source.type ~= 'local' and source.type ~= 'getlocal' and source.type ~= 'setlocal' @@ -21,8 +21,9 @@ local function findDef(sch, source, callback) if info.mode == 'declare' or info.mode == 'set' or info.mode == 'return' then - local src = info.source - local uri = info.uri + local src = info.source + local root = guide.getRoot(src) + local uri = root.uri if src.type == 'setfield' or src.type == 'getfield' or src.type == 'tablefield' then @@ -41,8 +42,7 @@ local function findDef(sch, source, callback) end) end ----@param sch searcher -local function checkRequire(sch, source, offset, callback) +local function checkRequire(source, offset, callback) if source.type ~= 'call' then return end @@ -80,7 +80,7 @@ return function (uri, offset) end local results = {} guide.eachSourceContain(ast.ast, offset, function (source) - checkRequire(searcher, source, offset, function (uri) + checkRequire(source, offset, function (uri) results[#results+1] = { uri = files.getOriginUri(uri), source = source, @@ -90,7 +90,7 @@ return function (uri, offset) } } end) - findDef(searcher, source, function (target, uri) + findDef(source, function (target, uri) results[#results+1] = { target = target, uri = files.getOriginUri(uri), -- cgit v1.2.3