summaryrefslogtreecommitdiff
path: root/server-beta/src/proto/interface.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-09-23 12:35:55 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-09-23 12:35:55 +0800
commit93a19c3772c8f0c0f01c0f9669a3cb0ba7393986 (patch)
tree226b04d00db0fb2f02f6b437ede80dfc6423f18e /server-beta/src/proto/interface.lua
parentce6c767448b82dc26faf06e2956f5327aebd8f5e (diff)
downloadlua-language-server-93a19c3772c8f0c0f01c0f9669a3cb0ba7393986.zip
修正一些bug
Diffstat (limited to 'server-beta/src/proto/interface.lua')
-rw-r--r--server-beta/src/proto/interface.lua18
1 files changed, 16 insertions, 2 deletions
diff --git a/server-beta/src/proto/interface.lua b/server-beta/src/proto/interface.lua
index 21be1cdf..ddba623a 100644
--- a/server-beta/src/proto/interface.lua
+++ b/server-beta/src/proto/interface.lua
@@ -11,7 +11,7 @@ local m = {}
function m.offset(lines, text, position)
local row = position.line
local start = guide.lineRange(lines, row)
- local col = utf8.offset(text, position.character, start)
+ local col = utf8.offset(text, position.character + 1, start)
local offset = guide.offsetOf(lines, row, col)
return offset
end
@@ -25,7 +25,7 @@ end
function m.position(lines, text, offset)
local row, col = guide.positionOf(lines, offset)
local start = guide.lineRange(lines, row)
- local ucol = utf8.len(text, start, col, true)
+ local ucol = utf8.len(text, start + 1, col, true)
return {
line = row,
character = ucol,
@@ -56,4 +56,18 @@ function m.location(uri, range)
}
end
+---@alias locationLink table
+---@param uri string
+---@param range range
+---@param selection range
+---@param origin range
+function m.locationLink(uri, range, selection, origin)
+ return {
+ targetUri = uri,
+ targetRange = range,
+ targetSelectionRange = selection,
+ originSelectionRange = origin,
+ }
+end
+
return m