summaryrefslogtreecommitdiff
path: root/server-beta
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-11-04 15:31:45 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-11-04 15:31:45 +0800
commit318f70aeb98b0a1cca0d69b440e08b15c1aca2c4 (patch)
tree9032a0b18fab8ae3e6b04cf4178216802499f025 /server-beta
parent8b0c1b531ea5db979fa50b4d11d511dddc34df13 (diff)
downloadlua-language-server-318f70aeb98b0a1cca0d69b440e08b15c1aca2c4.zip
修正provider的一些错误
Diffstat (limited to 'server-beta')
-rw-r--r--server-beta/src/proto/provider.lua15
1 files changed, 8 insertions, 7 deletions
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