Skip to content

Commit

Permalink
fix(hint): attempt to index a nil value
Browse files Browse the repository at this point in the history
Fixes: LuaLS#2788
  • Loading branch information
tmillr authored and sumneko committed Aug 15, 2024
1 parent d6d3d4b commit 12a7812
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased
<!-- Add all new changes here. They will be moved under a version at release -->
* `FIX` Error `attempt to index a nil value` when `Lua.hint.semicolon == 'All'` [#2788](https://github.com/LuaLS/lua-language-server/issues/2788)

## 3.10.3
`2024-8-8`
Expand Down
3 changes: 3 additions & 0 deletions script/core/hint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ local function semicolonHint(uri, results, start, finish)
---@async
guide.eachSourceTypes(state.ast, blockTypes, function (src)
await.delay()
if #src < 1 then return end

for i = 1, #src - 1 do
local current = src[i]
local next = src[i+1]
Expand All @@ -313,6 +315,7 @@ local function semicolonHint(uri, results, start, finish)
end
end
end

if mode == 'All' then
local last = src[#src]
results[#results+1] = {
Expand Down

0 comments on commit 12a7812

Please sign in to comment.