diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-10-11 00:30:53 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-10-11 00:30:53 +0800 |
commit | 566536d7de551299cd81c43948c46cf5b38e04a5 (patch) | |
tree | 58e727bb3841d5ed6edd03636661af059f39dacc /script/proto/converter.lua | |
parent | 296ac8d369d3b64d075f432934d5c6e2b2ca0207 (diff) | |
download | lua-language-server-566536d7de551299cd81c43948c46cf5b38e04a5.zip |
fix #1606
Diffstat (limited to 'script/proto/converter.lua')
-rw-r--r-- | script/proto/converter.lua | 8 |
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 |