Open nickjer opened 11 hours ago
The error comes from here: https://github.com/neovim/neovim/blob/d3b4772ddcd4c890dc5bc38e1f1b36a08aed0c04/runtime/lua/vim/lsp/rpc.lua#L461-L462
If tonumber()
is failing, that suggests we got something different than we sent. tonumber('42')
returns 42
, so that suggests that "steep" is not returning the response id that we sent (which would be a bug in "steep").
As a UX improvement, we could at least print the invalid result in the assert.
Interesting, I'll follow up with the author on this. In the meantime is there any way to find this errant response in the logs? Or does it crash before the log message is generated?
In the meantime is there any way to find this errant response in the logs?
one way is to just change that line to:
local result_id = assert(tonumber(decoded.id), 'response id must be a number: ' .. vim.inspect(decoded))
then restart Nvim. what does it print?
Oh nice...
Error executing luv callback:
...squashfs-root/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:461: response id must be a number: {
id = "cabb3a89-ead8-4aa1-bc03-82873562c130",
jsonrpc = "2.0",
result = {
completed = true,
duration = 0,
finished_at = "2024-10-03T08:13:24-04:00",
guid = "cabb3a89-ead8-4aa1-bc03-82873562c130",
started_at = "2024-10-03T08:13:23-04:00"
}
}
stack traceback:
[C]: in function 'assert'
...squashfs-root/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:461: in function 'handle_body'
...squashfs-root/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:762: in function 'handle_body'
...squashfs-root/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:267: in function <...squashfs-root/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:251>
I think I saw something similar in the logs that I attached to this issue. Where it looks like the token
is used as the id
in this one response that returns completed = true
.
But one thing I unsure of is what was the original id
sent to the LSP that would trigger this mismatch. I only ask because all the messages before this have no id
in the log.
Problem
After upgrading
steep
to 1.8.0 I am consistently seeing:I opened up an issue in the
steep
repo here: https://github.com/soutaro/steep/issues/1246The author mentions that the spec does allow Strings for response id's:
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#requestMessage
Any guidance on possibly tracking down this issue would help.
Steps to reproduce using "nvim -u minimal_init.lua"
Take everything below with a grain of salt as I am only replacing the top few variables. I am unfamiliar with the rest.
Expected behavior
Not raise the error.
Nvim version (nvim -v)
v0.10.2
Language server name/version
steep 1.8.0
Operating system/version
Pop!_OS 22.04 LTS
Log file
https://gist.github.com/nickjer/4b64c1e11d423cfa941321a251200944