summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-12-24 14:36:14 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-12-24 14:36:26 +0800
commitc6549d9dd8eb8dfca684f6a25dc7e1c01dcaf358 (patch)
tree5df50fafc639efef20b07938d299776a36cf2418
parent59a9b96ccc7c251ec46929667c3decc10ba42dd2 (diff)
downloadlua-language-server-c6549d9dd8eb8dfca684f6a25dc7e1c01dcaf358.zip
fix #863
-rw-r--r--changelog.md1
-rw-r--r--script/parser/guide.lua2
-rw-r--r--script/parser/newparser.lua2
3 files changed, 3 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md
index 92465e50..846ae89f 100644
--- a/changelog.md
+++ b/changelog.md
@@ -2,6 +2,7 @@
## 2.5.6
* `CHG` diagnostic: now syntax errors in `LuaDoc` are shown as `Warning`
+* `FIX` [#863](https://github.com/sumneko/lua-language-server/issues/863)
* `FIX` return type of `math.floor`
* `FIX` runtime errors
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index d55ba099..544f3eaa 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -781,7 +781,7 @@ function m.offsetToPositionByLines(lines, offset)
row = (left + right) // 2
if row == left then
if right ~= left then
- if lines[right] <= offset then
+ if lines[right] - 1 <= offset then
row = right
end
end
diff --git a/script/parser/newparser.lua b/script/parser/newparser.lua
index 15d2d600..c2ea8d13 100644
--- a/script/parser/newparser.lua
+++ b/script/parser/newparser.lua
@@ -537,7 +537,7 @@ local function skipComment(isAction)
State.comms[#State.comms+1] = {
type = chead and 'comment.cshort' or 'comment.short',
start = left,
- finish = getPosition(Tokens[Index], 'right'),
+ finish = lastRightPosition(),
text = ssub(Lua, start + 2, Tokens[Index] and (Tokens[Index] - 1) or #Lua),
}
return true