From 318f70aeb98b0a1cca0d69b440e08b15c1aca2c4 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 15:31:45 +0800 Subject: =?UTF-8?q?=E4=BF=AE=E6=AD=A3provider=E7=9A=84=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-beta/src/proto/provider.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'server-beta/src') diff --git a/server-beta/src/proto/provider.lua b/server-beta/src/proto/provider.lua index a27066aa..1799a284 100644 --- a/server-beta/src/proto/provider.lua +++ b/server-beta/src/proto/provider.lua @@ -1,10 +1,9 @@ local util = require 'utility' local cap = require 'proto.capability' -local pub = require 'pub' local task = require 'task' local files = require 'files' local proto = require 'proto.proto' -local inte = require 'proto.interface' +local interface = require 'proto.interface' local workspace = require 'workspace' local config = require 'config' @@ -155,17 +154,19 @@ proto.on('textDocument/definition', function (params) end local lines = files.getLines(uri) local text = files.getText(uri) - local offset = inte.offset(lines, text, params.position) + local offset = interface.offset(lines, text, params.position) local result = core(uri, offset) if not result then return nil end local response = {} for i, info in ipairs(result) do - response[i] = inte.locationLink(info.uri - , inte.range(lines, text, info.target.start - 1, info.target.finish) - , inte.range(lines, text, info.target.start - 1, info.target.finish) - , inte.range(lines, text, info.source.start - 1, info.source.finish) + local targetUri = info.uri + local targetLines = files.getLines(targetUri) + response[i] = interface.locationLink(targetUri + , interface.range(targetLines, text, info.target.start - 1, info.target.finish) + , interface.range(targetLines, text, info.target.start - 1, info.target.finish) + , interface.range(lines , text, info.source.start - 1, info.source.finish) ) end return response -- cgit v1.2.3