ruby-lsp: Version 0.23 breaks NeoVim integration

Description

While typing Neovim sends incomplete code to ruby-lsp which results in errors like this:

[ERROR][2025-01-07 12:37:03] ...m/lsp/client.lua:1041 "LSP[ruby_lsp]" "on_error" { code = "NO_RESULT_CALLBACK_FOUND", err = { id = 16, jsonrpc = "2.0", result = { items = { { message = "unexpected end-of-input, assuming it is closing the parent top level context", range = { ["end"] = { character = 0, line = 160 }, start = { character = 3, line = 159 } }, severity = 1, source = "Prism" }, { message = "expected anendto close theclassstatement", range = { ["end"] = { character = 0, line = 160 }, start = { character = 0, line = 160 } }, severity = 1, source = "Prism" }, { message = "mismatched indentations at 'end' with 'if' at 71", range = { ["end"] = { character = 5, line = 80 }, start = { character = 2, line = 80 } }, severity = 2, source = "Prism" }, { message = "mismatched indentations at 'end' with 'def' at 70", range = { ["end"] = { character = 3, line = 159 }, start = { character = 0, line = 159 } }, severity = 2, source = "Prism" } }, kind = "full" } } }

It is impossible to type now, because it seems these errors pop up on each key stroke. Reverting to version 0.22.1 fixes the issue.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 8
  • Comments: 38 (25 by maintainers)

Commits related to this issue

Most upvoted comments

I released v0.23.3, which includes the fix that @natematykiewicz indicated solves the issue (and some other fixes). Thank you everyone for the help investigating this.

@dbaeumer I’m going to have to review my whole understanding of the cancellation flow, I’m quite confused at the moment. Do the general.staleRequestSupport capabilities impact what needs to happen in the server during a cancellation?

@natematykiewicz you could do:

  lspconfig.ruby_lsp.setup({ capabilities = capabilities, cmd = { 'ruby-lsp', '--branch', 'main' } })

then it automatically picks main branch version, not the latest gem version. I guess main@12345 will also work, but I haven’t tested it with commit. If it will work, it may be possible to revert to older commits or freeze version.

However, latest master seems not crashing atm after revert, thnks @vinistock .

If you’re trying to debug ruby-lsp, I find it helpful to add it to your application Gemfile. The ruby-lsp should then honour that version and not clobber it.

Paired with path: option can be helpful to debug local copies or bisect (tho bisecting has it’s own issues).

Okay, I created #3024 to revert the behaviour back to what it used to be (which didn’t cause problems for NeoVim) until we figure out what’s going on.

@dbaeumer can I ask you for some guidance? My understanding is that the server should return RequestCancelled for requests that were cancelled by the client, but the spec has no mention about what to do if the server receives the same request ID as a retry.

Is retrying cancelled requests expected? And what should servers respond with? The error response in the first request and then ignore the rest?

I’m happy to put up a PR adding more detail to the cancellation support text in the spec once we confirm what’s the expected behaviour.