diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-12-02 20:11:30 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-12-02 20:11:30 +0800 |
commit | 830be2cab0d5e45a32606bb33eba216c72a9ca66 (patch) | |
tree | 9e400ab0c69e238d5966d9f23918e4353c5ff09e /script/proto | |
parent | 5833c2aef04bd4704c86104275411ef330981f85 (diff) | |
download | lua-language-server-830be2cab0d5e45a32606bb33eba216c72a9ca66.zip |
fully support Doc.type.array
Diffstat (limited to 'script/proto')
-rw-r--r-- | script/proto/define.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/script/proto/define.lua b/script/proto/define.lua index 1cbb8de9..67898f9b 100644 --- a/script/proto/define.lua +++ b/script/proto/define.lua @@ -14,7 +14,7 @@ function m.offset(lines, text, position) if start <= 0 or start > #text then return #text + 1 end - local offset = utf8.offset(text, position.character + 1, start) + local offset = utf8.offset(text, position.character + 1, start) or (#text + 1) return offset - 1 end @@ -29,7 +29,7 @@ function m.offsetOfWord(lines, text, position) if start <= 0 or start > #text then return #text + 1 end - local offset = utf8.offset(text, position.character + 1, start) + local offset = utf8.offset(text, position.character + 1, start) or (#text + 1) if offset > #text or text:sub(offset-1, offset):match '[%w_][^%w_]' then offset = offset - 1 |