summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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