summaryrefslogtreecommitdiff
path: root/server-beta/src/proto
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-11-08 11:44:04 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-11-08 11:44:04 +0800
commit444851fc1adb2fe3a0f952807cb4b644e18790c1 (patch)
tree722586a59027734fbba91678e51d82061c3a923b /server-beta/src/proto
parentd2b9dee8ce0ae345e4efd43c112bb3efd4071888 (diff)
downloadlua-language-server-444851fc1adb2fe3a0f952807cb4b644e18790c1.zip
修正一些bug
Diffstat (limited to 'server-beta/src/proto')
-rw-r--r--server-beta/src/proto/define.lua4
-rw-r--r--server-beta/src/proto/provider.lua6
2 files changed, 5 insertions, 5 deletions
diff --git a/server-beta/src/proto/define.lua b/server-beta/src/proto/define.lua
index 6acd2348..ee968021 100644
--- a/server-beta/src/proto/define.lua
+++ b/server-beta/src/proto/define.lua
@@ -30,7 +30,7 @@ function m.position(lines, text, offset)
}
end
---- 将2个光标位置转化为 range
+--- 将起点与终点位置转化为 range
---@alias range table
---@param lines table
---@param text string
@@ -38,7 +38,7 @@ end
---@param offset2 integer
function m.range(lines, text, offset1, offset2)
return {
- start = m.position(lines, text, offset1),
+ start = m.position(lines, text, offset1-1),
['end'] = m.position(lines, text, offset2),
}
end
diff --git a/server-beta/src/proto/provider.lua b/server-beta/src/proto/provider.lua
index 08229f29..ea1fb203 100644
--- a/server-beta/src/proto/provider.lua
+++ b/server-beta/src/proto/provider.lua
@@ -167,9 +167,9 @@ proto.on('textDocument/definition', function (params)
local targetLines = files.getLines(targetUri)
local targetText = files.getText(targetUri)
response[i] = define.locationLink(targetUri
- , define.range(targetLines, targetText, info.target.start - 1, info.target.finish)
- , define.range(targetLines, targetText, info.target.start - 1, info.target.finish)
- , define.range(lines, text, info.source.start - 1, info.source.finish)
+ , define.range(targetLines, targetText, info.target.start, info.target.finish)
+ , define.range(targetLines, targetText, info.target.start, info.target.finish)
+ , define.range(lines, text, info.source.start, info.source.finish)
)
end
return response