summaryrefslogtreecommitdiff
path: root/script/files.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-01-26 16:12:57 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-01-26 16:12:57 +0800
commit863ba7697bacc427c70dad04b33e1ad76da07019 (patch)
tree76f0060ac67eaf088fe18d35dd1a571bff538ea2 /script/files.lua
parentaec13d09d7e54e0032b882744abf206369c6f93a (diff)
downloadlua-language-server-863ba7697bacc427c70dad04b33e1ad76da07019.zip
fix
Diffstat (limited to 'script/files.lua')
-rw-r--r--script/files.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/script/files.lua b/script/files.lua
index fd8216ca..1e7c15e9 100644
--- a/script/files.lua
+++ b/script/files.lua
@@ -465,13 +465,13 @@ function m.offsetOfWord(uri, position)
else
offset = utf8.offset(text, position.character + 1, start) or (#text + 1)
end
- if file._diffInfo then
- offset = smerger.getOffset(file._diffInfo, offset)
- end
if offset > #text
or text:sub(offset-1, offset):match '[%w_][^%w_]' then
offset = offset - 1
end
+ if file._diffInfo then
+ offset = smerger.getOffset(file._diffInfo, offset)
+ end
return offset
end