From a67da00e8e2b61a2fa197188b7ffb3e3b83a2a74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 21 Mar 2019 15:41:59 +0800 Subject: =?UTF-8?q?=E6=9B=B4=E5=8A=A0=E5=87=86=E7=A1=AE=E7=9A=84=E5=88=86?= =?UTF-8?q?=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/method/textDocument/completion.lua | 2 +- server/src/method/textDocument/definition.lua | 2 +- server/src/method/textDocument/hover.lua | 2 +- server/src/method/textDocument/implementation.lua | 2 +- server/src/method/textDocument/references.lua | 2 +- server/src/method/textDocument/rename.lua | 3 +-- server/src/method/textDocument/signatureHelp.lua | 3 +-- 7 files changed, 7 insertions(+), 9 deletions(-) (limited to 'server/src/method/textDocument') diff --git a/server/src/method/textDocument/completion.lua b/server/src/method/textDocument/completion.lua index 0b559145..439cf0c1 100644 --- a/server/src/method/textDocument/completion.lua +++ b/server/src/method/textDocument/completion.lua @@ -64,7 +64,7 @@ return function (lsp, params) local lines = parser:lines(text, 'utf8') -- lua是从1开始的,因此都要+1 - local position = lines:position(params.position.line + 1, params.position.character + 1) + local position = lines:positionAsChar(params.position.line + 1, params.position.character) local word = findWord(position, text) local startPos = findStartPos(position, text) diff --git a/server/src/method/textDocument/definition.lua b/server/src/method/textDocument/definition.lua index a9c05752..e1c45317 100644 --- a/server/src/method/textDocument/definition.lua +++ b/server/src/method/textDocument/definition.lua @@ -17,7 +17,7 @@ return function (lsp, params) return nil end -- lua是从1开始的,因此都要+1 - local position = lines:position(params.position.line + 1, params.position.character + 1) + local position = lines:positionAsChar(params.position.line + 1, params.position.character) local source = core.findSource(vm, position) if not source then return nil diff --git a/server/src/method/textDocument/hover.lua b/server/src/method/textDocument/hover.lua index 5bb8cbb9..4ea76d6d 100644 --- a/server/src/method/textDocument/hover.lua +++ b/server/src/method/textDocument/hover.lua @@ -7,7 +7,7 @@ return function (lsp, params) return nil end -- lua是从1开始的,因此都要+1 - local position = lines:position(params.position.line + 1, params.position.character + 1) + local position = lines:positionAsChar(params.position.line + 1, params.position.character) local source = core.findSource(vm, position) if not source then diff --git a/server/src/method/textDocument/implementation.lua b/server/src/method/textDocument/implementation.lua index c9062180..8bd35a6c 100644 --- a/server/src/method/textDocument/implementation.lua +++ b/server/src/method/textDocument/implementation.lua @@ -17,7 +17,7 @@ return function (lsp, params) return nil end -- lua是从1开始的,因此都要+1 - local position = lines:position(params.position.line + 1, params.position.character + 1) + local position = lines:positionAsChar(params.position.line + 1, params.position.character) local source = core.findSource(vm, position) if not source then return nil diff --git a/server/src/method/textDocument/references.lua b/server/src/method/textDocument/references.lua index 8b5fcab7..cdc25f05 100644 --- a/server/src/method/textDocument/references.lua +++ b/server/src/method/textDocument/references.lua @@ -9,7 +9,7 @@ return function (lsp, params) end -- lua是从1开始的,因此都要+1 - local position = lines:position(params.position.line + 1, params.position.character + 1) + local position = lines:positionAsChar(params.position.line + 1, params.position.character) local positions = core.references(vm, position, declarat) if not positions then return {} diff --git a/server/src/method/textDocument/rename.lua b/server/src/method/textDocument/rename.lua index fcbdfef7..95ee0cfe 100644 --- a/server/src/method/textDocument/rename.lua +++ b/server/src/method/textDocument/rename.lua @@ -7,8 +7,7 @@ return function (lsp, params) if not vm then return {} end - -- lua是从1开始的,因此都要+1 - local position = lines:position(params.position.line + 1, params.position.character + 1) + local position = lines:positionAsChar(params.position.line + 1, params.position.character) local positions = core.rename(vm, position, newName) if not positions then return {} diff --git a/server/src/method/textDocument/signatureHelp.lua b/server/src/method/textDocument/signatureHelp.lua index cf9935bd..98d2ea9b 100644 --- a/server/src/method/textDocument/signatureHelp.lua +++ b/server/src/method/textDocument/signatureHelp.lua @@ -6,8 +6,7 @@ return function (lsp, params) if not vm then return end - -- lua是从1开始的,因此都要+1 - local position = lines:position(params.position.line + 1, params.position.character + 1) + local position = lines:positionAsChar(params.position.line + 1, params.position.character) local hovers = core.signature(vm, position) if not hovers then return -- cgit v1.2.3