diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-21 15:41:59 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-21 15:41:59 +0800 |
commit | a67da00e8e2b61a2fa197188b7ffb3e3b83a2a74 (patch) | |
tree | 749c08fa9ad3e5131c24592c72db121e1bb9d601 /server/src/method | |
parent | b80dc1e6acaf9df1c2f53ca83f0ed9cbf8e1fa71 (diff) | |
download | lua-language-server-a67da00e8e2b61a2fa197188b7ffb3e3b83a2a74.zip |
更加准确的分词
Diffstat (limited to 'server/src/method')
-rw-r--r-- | server/src/method/textDocument/completion.lua | 2 | ||||
-rw-r--r-- | server/src/method/textDocument/definition.lua | 2 | ||||
-rw-r--r-- | server/src/method/textDocument/hover.lua | 2 | ||||
-rw-r--r-- | server/src/method/textDocument/implementation.lua | 2 | ||||
-rw-r--r-- | server/src/method/textDocument/references.lua | 2 | ||||
-rw-r--r-- | server/src/method/textDocument/rename.lua | 3 | ||||
-rw-r--r-- | server/src/method/textDocument/signatureHelp.lua | 3 |
7 files changed, 7 insertions, 9 deletions
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 |