summaryrefslogtreecommitdiff
path: root/script/proto/converter.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-10-11 00:30:53 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-10-11 00:30:53 +0800
commit566536d7de551299cd81c43948c46cf5b38e04a5 (patch)
tree58e727bb3841d5ed6edd03636661af059f39dacc /script/proto/converter.lua
parent296ac8d369d3b64d075f432934d5c6e2b2ca0207 (diff)
downloadlua-language-server-566536d7de551299cd81c43948c46cf5b38e04a5.zip
fix #1606
Diffstat (limited to 'script/proto/converter.lua')
-rw-r--r--script/proto/converter.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/script/proto/converter.lua b/script/proto/converter.lua
index 3f5ddebc..56b45c1f 100644
--- a/script/proto/converter.lua
+++ b/script/proto/converter.lua
@@ -88,9 +88,11 @@ local function diffedUnpackPosition(uri, position)
local text = files.getOriginText(uri)
if text then
local lineOffset = originLines[row]
- local textOffset = encoder.offset(offsetEncoding, text, col + 1, lineOffset)
- if textOffset and lineOffset then
- col = textOffset - lineOffset
+ if lineOffset then
+ local textOffset = encoder.offset(offsetEncoding, text, col + 1, lineOffset)
+ if textOffset and lineOffset then
+ col = textOffset - lineOffset
+ end
end
end
end