LuaLS / LuaLS/lua-language-server

Request textDocument/hover failed.

Open
#3,385 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Lua
Stars
4.4k
Forks
442
PR merge metrics
No merged PRs in 30d

Description

### How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

### Which OS are you using?

MacOS

### What is the issue affecting?

Hover

### Expected Behaviour

no errors when hover

### Actual Behaviour

error popups when hover

[error][#0:script/vm/global.lua:640]: script/vm/global.lua:640: attempt to index a nil value (local 'source')
stack traceback:
script/vm/global.lua:640: in function 'vm.vm.getGlobalNode'
(...tail calls...)
script/vm/visible.lua:182: in field 'isVisible'
script/core/hover/table.lua:105: in upvalue 'getVisibleKeyMap'
script/core/hover/table.lua:188: in upvalue 'buildTable'
script/core/hover/label.lua:51: in function
(...tail calls...)
script/core/hover/init.lua:37: in local 'addHover'
script/core/hover/init.lua:92: in upvalue 'getHover'
script/core/hover/init.lua:144: in field 'byUri'
script/provider/provider.lua:368: in function <script/provider/provider.lua:346>
[C]: in global 'xpcall'
script/proto/proto.lua:202: in function <script/proto/proto.lua:177>

### Reproduction steps

```lua
---@alias namespace.B<T> A<T>

---@class namespace.C<T>
---@field _x T

---@class namespace.D<T>

---@class A<T>:namespace.C<T>,namespace.D<T>
local A = {}
```

hover on A

### Additional Notes

_No response_

### Log File

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure by hovering over A in the Lua snippet, then start at script/vm/global.lua:640 and trace the calls through script/vm/visible.lua:182 and script/core/hover/table.lua:105. Done means the reported hover request produces no error popup and still returns the expected hover information for the reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.