Ruby LSP indexing files seems to hang at 100%
This never goes away:
The editor will send RPC messages, but it never seems to get a response.
LSP Logs:
// Receive:
{"method":"$/progress","params":{"token":"indexing-progress","value":{"kind":"report","message":"97% completed","percentage":97}},"jsonrpc":"2.0"}
// Receive:
{"method":"$/progress","params":{"token":"indexing-progress","value":{"kind":"report","message":"98% completed","percentage":98}},"jsonrpc":"2.0"}
// Receive:
{"method":"$/progress","params":{"token":"indexing-progress","value":{"kind":"report","message":"99% completed","percentage":99}},"jsonrpc":"2.0"}
// Receive:
{"method":"$/progress","params":{"token":"indexing-progress","value":{"kind":"report","message":"100% completed","percentage":100}},"jsonrpc":"2.0"}
// Send:
{"jsonrpc":"2.0","id":5,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///Users/samclopton/workspace/clever-case/app/models/xero_api.rb"},"position":{"line":27,"character":25}}}
// Send:
{"jsonrpc":"2.0","id":6,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"file:///Users/samclopton/workspace/clever-case/app/models/xero_api.rb"},"range":{"start":{"line":27,"character":25},"end":{"line":27,"character":25}},"context":{"diagnostics":[],"only":["","quickfix","refactor","refactor.extract","source"]}}}
// Send:
{"jsonrpc":"2.0","id":7,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///Users/samclopton/workspace/clever-case/app/models/xero_api.rb"},"position":{"line":20,"character":13}}}
// Send:
{"jsonrpc":"2.0","method":"$/cancelRequest","params":{"id":7}}
// Send:
{"jsonrpc":"2.0","id":8,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///Users/samclopton/workspace/clever-case/app/models/xero_api.rb"},"position":{"line":20,"character":13}}}
// Send:
{"jsonrpc":"2.0","method":"$/cancelRequest","params":{"id":8}}
It has been doing this for a few weeks. Interestingly, restarting after the latest zed update make it work, but after a subsequent restart, it continues to hang at 100%.
Hi! Thanks for reporting this. I marked it as an upstream issue (in Ruby LSP), but I'm not fully sure. I'll double-check.
@Samsinite can you please check which Ruby LSP version you're using? And Ruby version as well, I think.
Hi! Thanks for reporting this. I marked it as an upstream issue (in Ruby LSP), but I'm not fully sure. I'll double-check.
@Samsinite can you please check which Ruby LSP version you're using? And Ruby version as well, I think.
On ruby 3.1.7, just updated ruby-lsp to 0.26.1 in the Gemfile and still getting the same issue,
I have had the same issue for a few weeks; it's reproducible on 2 MacBooks with ruby-lsp 0.22.1, 0.23.24, and 0.26.* in 3 different projects with Ruby 3.0.6. At the same time, it works fine with VSCode.
I believe my issues here are related to this. Ruby LSP (and the ruby process) are showing very high CPU usage in the last few weeks. Zed became really sluggish when working with Ruby files, with LSP errors taking several seconds to render on screen (or errors taking time to disappear).
I don't have these issues in VS Code.
I do want to mention that upgrading to Ruby 3.2 has thankfully solved this issue for me. Still curious why the ruby-lsp extension in VSCode works though and not the ruby Zed extension.
I do want to mention that upgrading to Ruby 3.2 has thankfully solved this issue for me. Still curious why the ruby-lsp extension in VSCode works though and not the ruby Zed extension.
I think this could be due to differences in implementation. The Ruby extension for Zed does not have all the features that the extension for VSCode has because Zed's API is limited.
This is an unfortunate bug, as I can't seem to use Zed anymore due to the memory and CPU usage. Completely locks up my computer after an hour or so.
Can anyone reproduce the indexing hanging outside of Zed?
# ruby_lsp_index.rb
require "ruby_lsp/internal"
index = RubyIndexer::Index.new
index.index_all do |progress|
puts "Progress: #{progress}%"
true
end
$ bundle exec ruby ruby_lsp_index.rb
$ bundle exec ruby --yjit ruby_lsp_index.rb # maybe it only happens with YJIT?