summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/core/command/removeSpace.lua5
-rw-r--r--script/core/diagnostics/trailing-space.lua3
-rw-r--r--script/proto/converter.lua2
-rw-r--r--script/provider/provider.lua2
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],
}
}