diff options
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | script/core/hint.lua | 3 | ||||
-rw-r--r-- | script/service/service.lua | 2 |
3 files changed, 5 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md index 7e5d6aa3..3be4b982 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,7 @@ ## Unreleased <!-- Add all new changes here. They will be moved under a version at release --> * `FIX` Improved ordering of results for `textDocument/definition`. +* `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` diff --git a/script/core/hint.lua b/script/core/hint.lua index 9d098aa9..b0ff5aa7 100644 --- a/script/core/hint.lua +++ b/script/core/hint.lua @@ -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] @@ -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] = { diff --git a/script/service/service.lua b/script/service/service.lua index 3fad865a..c7675f1b 100644 --- a/script/service/service.lua +++ b/script/service/service.lua @@ -250,7 +250,7 @@ function m.testVersion() end function m.sayHello() - proto.notify('$/hello', 'world') + proto.notify('$/hello', {'world'}) end function m.lockCache() |