summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server-beta/src/files.lua3
-rw-r--r--server-beta/src/proto/interface.lua5
-rw-r--r--server-beta/src/proto/provider.lua6
3 files changed, 7 insertions, 7 deletions
diff --git a/server-beta/src/files.lua b/server-beta/src/files.lua
index 7d1fe0da..0d8bd526 100644
--- a/server-beta/src/files.lua
+++ b/server-beta/src/files.lua
@@ -25,6 +25,7 @@ end
--- 设置文件文本
function m.setText(uri, text)
+ local originUri = uri
if platform.OS == 'Windows' then
uri = uri:lower()
end
@@ -40,7 +41,7 @@ function m.setText(uri, text)
pub.removeTask(file.compiling)
end
file.compiling = pub.syncTask('compile', text, function (ast)
- ast.uri = uri
+ ast.uri = originUri
file.ast = ast
file.compiling = nil
local onCompiledList = file.onCompiledList
diff --git a/server-beta/src/proto/interface.lua b/server-beta/src/proto/interface.lua
index ddba623a..6af0c996 100644
--- a/server-beta/src/proto/interface.lua
+++ b/server-beta/src/proto/interface.lua
@@ -11,8 +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 + 1, start)
- local offset = guide.offsetOf(lines, row, col)
+ local offset = utf8.offset(text, position.character + 1, start)
return offset
end
@@ -25,7 +24,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 + 1, col, true)
+ local ucol = utf8.len(text, start + 1, start + col, true)
return {
line = row,
character = ucol,
diff --git a/server-beta/src/proto/provider.lua b/server-beta/src/proto/provider.lua
index 9e3fe019..38428362 100644
--- a/server-beta/src/proto/provider.lua
+++ b/server-beta/src/proto/provider.lua
@@ -71,9 +71,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, info.target.finish)
- , inte.range(ast.lines, text, info.target.start, info.target.finish)
- , inte.range(ast.lines, text, info.source.start, info.source.finish)
+ , 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)
)
end
return response