Closed slhck closed 1 month ago
I am using VS Code 1.91.1 with the v0.7.14 Ruby LSP extension.
Is there any reason not to use the latest extension? Can you update the extension and paste the relevant information here?
Normally, even when an addon failed to activate, the Ruby LSP process would still be running. Does the status panel show it's running?
If it does, then the issue is purely related to ruby-lsp-rails
. If it doesn't, then it means we have a separate issue on the Ruby LSP side too, and the additional information from the command will help a lot 🙂
I am using VS Code 1.91.1 with the v0.7.14 Ruby LSP extension.
Is there any reason not to use the latest extension? Can you update the extension and paste the relevant information here?
I didn't get any update notification for it, now I am on v0.7.19! Thanks for catching that.
Normally, even when an addon failed to activate, the Ruby LSP process would still be running. Does the status panel show it's running?
It's running indeed:
Although it says v0.7.17, despite the extension being v0.7.19 …
If it does, then the issue is purely related to
ruby-lsp-rails
. If it doesn't, then it means we have a separate issue on the Ruby LSP side too, and the additional information from the command will help a lot 🙂
I understand this to be an issue in https://github.com/Shopify/ruby-lsp-rails, so I will close accordingly.
@slhck Sorry that I wasn't clear, if it's a ruby-lsp-rails
issue I can simply transfer it there 😅 Thanks for confirming 🙂
Oh, alright, thanks!
I think I have to clarify that I was more confused about the fact that it's even trying to boot Sidekiq in the first place. I could get everything working once I set up the Redis server, but I didn't expect the LSP to require that for code analysis. Or is it merely triggering the start of the Sidekiq worker when reading its configurarion file?
Ruby LSP Rails starts a Rails application process in background to collect runtime information as explained here.
From the backtrace:
from /Users/werner/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sidekiq-7.3.0/lib/sidekiq/api.rb:776:in `initialize'
from /Users/werner/Documents/Projects/example/config/initializers/sidekiq.rb:93:in `new'
from /Users/werner/Documents/Projects/example/config/initializers/sidekiq.rb:93:in `<main>'
It looks like your app is trying to initialize ScheduledSet
and that causes Sidekiq to make a Redis connection EVERY time your app is loaded, which includes running many rake tasks, Rails runner, Rails console...etc. So maybe you'd want to wrap it inside a callback like:
# config/initializers/sidekiq.rb
Sidekiq.configure_server do |config|
config.on(:startup) do
# something that needs Sidekiq::ScheduledSet.new
end
end
And then that code will only be performed when the apps is loaded by Sidekiq.
Thanks for the great explanation! So it runs any initializer as a normal Rails app would. I can work around this. I wonder if we could address this somehow in the documentation such that unexpected errors like this can be discovered better? Then again, maybe this issue is enough, and this is just an edge case.
I'll close this for now.
Description
Ruby LSP Information
Please run
Collect Ruby LSP Information for Issue Reporting
from VS Code's command palette and paste the result hereI have no such command!
I am using VS Code 1.91.1 with the v0.7.14 Ruby LSP extension.
The problem is that it somehow tries to boot Sidekiq, which again tries to connect to a Redis server that does not exist (since my actual Redis server runs in Docker, and the Rails app does, too).
How could I bypass this?
Reproduction steps
Code snippet or error message