soutaro / steep

Static type checker for Ruby
MIT License
1.36k stars 83 forks source link

LSP "response id must be a number" error in neovim #1246

Open nickjer opened 2 days ago

nickjer commented 2 days ago

Just want to first say this is an amazing project. I have been using the LSP server in the 1.7.1 release for awhile now with no issues in neovim.

But I just recently upgraded steep to 1.8.0 and now neovim is providing a stacktrace:

Error executing luv callback:                                                                                                                                                                             
...nt_nvimwcukvL/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:462: response id must be a number                                                                                                             
stack traceback:                                                                                                                                                                                          
        [C]: in function 'assert'                                                                                                                                                                         
        ...nt_nvimwcukvL/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:462: in function 'handle_body'                                                                                                        
        ...nt_nvimwcukvL/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:765: in function 'handle_body'                                                                                                        
        ...nt_nvimwcukvL/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:267: in function <...nt_nvimwcukvL/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:251>

I wasn't entirely sure if I should be posting this issue here, but the only thing that changed was going from steep 1.7.1 to 1.8.0. If I downgrade back to 1.7.1 then it goes away.

Feel free to close this issue if you feel it has nothing to do with steep. I lack the expertise here to say one way or the other.

nickjer commented 1 day ago

~Alright, I have since updated my neovim to the latest nightly release NVIM v0.11.0-dev-881+g865ba42e0 and I do not see this issue anymore. I'll close this issue since I cannot reproduce it anymore.~

I made a dumb mistake and was actually using the old steep 1.7.1. So ignore the above.

soutaro commented 8 hours ago

@nickjer Thank you for letting us know this issue.

If it's about the LSP messages, it might be an issue of neovim because the spec says they can be a string. https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#requestMessage

It's possible to make them numbers in Steep technically, but I want to know more detail of the problem.

  1. Is it about LSP messages?
  2. How is the opinion of neovim team?
nickjer commented 5 hours ago

I did finally manage to dump logs from neovim. Even in steep 1.7.1 I do see String id's (on occasion) and that ran just fine, so I am not sure what is causing the crash with 1.8.0.

I did notice the comment above the problem line:

https://github.com/neovim/neovim/blob/c6abc97006eee7fc89baefad2e1bddb248187f2e/runtime/lua/vim/lsp/rpc.lua#L461-L462

-- We sent a number, so we expect a number.

Was there any change to steep 1.8.0 that would cause the id to be different than what was sent to it?

In the meantime I'll also open up an issue on the neovim repo. Thanks for following up.

NOTE: If it helps here are the two log files dumped from neovim for each https://gist.github.com/nickjer/4b64c1e11d423cfa941321a251200944