diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-09-23 19:28:34 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-09-23 19:28:34 +0800 |
commit | 5e6897bc1a25b936724af6eeb5fc463a8d395d1e (patch) | |
tree | c1c12d3b81087d201dfc2ffb8b3535ff73ba6965 /script | |
parent | 127f0c549bb46d218e4b81db6c4ffd40394927ae (diff) | |
download | lua-language-server-5e6897bc1a25b936724af6eeb5fc463a8d395d1e.zip |
fix
Diffstat (limited to 'script')
-rw-r--r-- | script/core/command/removeSpace.lua | 5 | ||||
-rw-r--r-- | script/core/diagnostics/trailing-space.lua | 3 | ||||
-rw-r--r-- | script/proto/converter.lua | 2 | ||||
-rw-r--r-- | script/provider/provider.lua | 2 |
4 files changed, 5 insertions, 7 deletions
diff --git a/script/core/command/removeSpace.lua b/script/core/command/removeSpace.lua index d92fee79..3021d4a4 100644 --- a/script/core/command/removeSpace.lua +++ b/script/core/command/removeSpace.lua @@ -20,11 +20,10 @@ return function (data) return end - local lines = {} + local lines = state.lines local textEdit = {} for i = 0, #lines do - local startPos = lines[i] - local startOffset = guide.positionToOffset(state, startPos) + local startOffset = lines[i] local finishOffset = text:find('[\r\n]', startOffset) or (#text + 1) local lastOffset = finishOffset - 1 local lastChar = text:sub(lastOffset, lastOffset) diff --git a/script/core/diagnostics/trailing-space.lua b/script/core/diagnostics/trailing-space.lua index 5c66b118..cc51cf77 100644 --- a/script/core/diagnostics/trailing-space.lua +++ b/script/core/diagnostics/trailing-space.lua @@ -20,8 +20,7 @@ return function (uri, callback) local text = files.getText(uri) local lines = state.lines for i = 0, #lines do - local startPos = lines[i] - local startOffset = guide.positionToOffset(state, startPos) + local startOffset = lines[i] local finishOffset = text:find('[\r\n]', startOffset) or (#text + 1) local lastOffset = finishOffset - 1 local lastChar = text:sub(lastOffset, lastOffset) diff --git a/script/proto/converter.lua b/script/proto/converter.lua index 9ff7e4dd..53b65b12 100644 --- a/script/proto/converter.lua +++ b/script/proto/converter.lua @@ -35,7 +35,7 @@ function m.unpackPosition(uri, position) local text = files.getText(uri) if text then local lineOffset = state.lines[row] - col = utf8.offset(text, col + 1, lineOffset) - 1 + col = utf8.offset(text, col + 1, lineOffset) - lineOffset end end local pos = guide.positionOf(row, col) diff --git a/script/provider/provider.lua b/script/provider/provider.lua index 938b3102..39683b2b 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -530,7 +530,7 @@ proto.on('textDocument/signatureHelp', function (params) for j, param in ipairs(result.params) do parameters[j] = { label = { - param.label[1] - 1, + param.label[1], param.label[2], } } |