Shopify / ruby-lsp-rails

A Ruby LSP add-on for Rails
https://shopify.github.io/ruby-lsp/rails-add-on
MIT License
581 stars 27 forks source link

Improve diagnostics for situations where Rails fails to boot #519

Closed andyw8 closed 1 week ago

andyw8 commented 3 weeks ago

Found while looking into https://github.com/Shopify/ruby-lsp-rails/issues/514

If the app's config/database.yml is missing, the add-on will fail to start in a way where it's hard to see the underlying problem:

2024-11-07 13:24:06.384 [info] (ruby-lsp-rails) [Error - 1:24:06 PM] Ruby LSP Rails failed to initialize server: /Users/andyw8/src/github.com/Shopify/ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb:296:in `block in read_response': RubyLsp::Rails::RunnerClient::EmptyMessageError (RubyLsp::Rails::RunnerClient::EmptyMessageError)
    from /Users/andyw8/src/github.com/Shopify/ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb:293:in `synchronize'
    from /Users/andyw8/src/github.com/Shopify/ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb:293:in `read_response'
...
...

Although this particular situation is probably uncommon, I expect that other kinds of problems may result in similar output.