summaryrefslogtreecommitdiff
path: root/server-beta/src/proto/provider.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-10-19 17:30:51 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-10-19 17:30:51 +0800
commitd9b4f493f08d55f479cebfcc6f16130ba0d6b35f (patch)
tree75fbf25231cac4e688e8a3b5dce9b67c119629ea /server-beta/src/proto/provider.lua
parentc1e44ccc9fed6166b52d08c6e48d1c21f27f5f6a (diff)
downloadlua-language-server-d9b4f493f08d55f479cebfcc6f16130ba0d6b35f.zip
在主线程用时编译
Diffstat (limited to 'server-beta/src/proto/provider.lua')
-rw-r--r--server-beta/src/proto/provider.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/server-beta/src/proto/provider.lua b/server-beta/src/proto/provider.lua
index 4eb1a669..0c029a45 100644
--- a/server-beta/src/proto/provider.lua
+++ b/server-beta/src/proto/provider.lua
@@ -154,8 +154,9 @@ proto.on('textDocument/definition', function (params)
if not ast then
return nil
end
+ local lines = files.getLines(uri)
local text = files.getText(uri)
- local offset = inte.offset(ast.lines, text, params.position)
+ local offset = inte.offset(lines, text, params.position)
local result = core(ast, text, offset)
if not result then
return nil
@@ -163,9 +164,9 @@ proto.on('textDocument/definition', function (params)
local response = {}
for i, info in ipairs(result) do
response[i] = inte.locationLink(info.uri
- , inte.range(ast.lines, text, info.target.start - 1, info.target.finish)
- , inte.range(ast.lines, text, info.target.start - 1, info.target.finish)
- , inte.range(ast.lines, text, info.source.start - 1, info.source.finish)
+ , 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)
)
end
return response