From b14edd27b790ea984276f40202e5ba4acba652ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 30 Jan 2019 13:43:48 +0800 Subject: =?UTF-8?q?=E7=AE=80=E5=8D=95=E6=94=AF=E6=8C=81=E6=9F=A5=E6=89=BE?= =?UTF-8?q?=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/references.lua | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'server/src/core') diff --git a/server/src/core/references.lua b/server/src/core/references.lua index f49ebbfc..7262ca91 100644 --- a/server/src/core/references.lua +++ b/server/src/core/references.lua @@ -1,26 +1,32 @@ local findResult = require 'core.find_result' -local function parseResult(result, declarat) +local function parseResult(vm, result, declarat) local positions = {} local tp = result.type if tp == 'local' then - for _, info in ipairs(result) do + vm:eachInfo(result, function (info) + if info.source.uri == '' or not info.source.uri then + return + end if declarat or info.type == 'get' then - positions[#positions+1] = {info.source.start, info.source.finish} + positions[#positions+1] = {info.source.start, info.source.finish, info.source.uri} end - end + end) elseif tp == 'field' then - for _, info in ipairs(result) do + vm:eachInfo(result, function (info) + if info.source.uri == '' or not info.source.uri then + return + end if declarat or info.type == 'get' then - positions[#positions+1] = {info.source.start, info.source.finish} + positions[#positions+1] = {info.source.start, info.source.finish, info.source.uri} end - end + end) elseif tp == 'label' then - for _, info in ipairs(result) do + vm:eachInfo(result, function (info) if declarat or info.type == 'goto' then - positions[#positions+1] = {info.source.start, info.source.finish} + positions[#positions+1] = {info.source.start, info.source.finish, info.source.uri} end - end + end) end return positions end @@ -30,6 +36,6 @@ return function (vm, pos, declarat) if not result then return nil end - local positions = parseResult(result, declarat) + local positions = parseResult(vm, result, declarat) return positions end -- cgit v1.2.3