Shopify / ruby-lsp-rails

A Ruby LSP addon for Rails
https://shopify.github.io/ruby-lsp-rails/
MIT License
518 stars 21 forks source link

LSP server fails while indexing files, but does not indicate which file failed #309

Closed bbouchet-trustpair closed 3 months ago

bbouchet-trustpair commented 3 months ago

Description

I installed the Ruby LSP extension in VS Cde Launching Lsp-server gives the following error:

LSP Rails failed to initialize server: unexpected token at ''
/Users/my_user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/json-2.7.1/lib/json/common.rb:219:in `parse'
/Users/my_user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/json-2.7.1/lib/json/common.rb:219:in `parse'
/Users/my_user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/ruby-lsp-rails-0.3.3/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb:138:in `read_response'
/Users/my_user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/sorbet-runtime-0.5.11311/lib/types/private/methods/_methods.rb:279:in `bind_call'
/Users/my_user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/sorbet-runtime-0.5.11311/lib/types/private/methods/_methods.rb:279:in `block in _on_method_added'
/Users/my_user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/ruby-lsp-rails-0.3.3/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb:62:in `initialize'
/Users/my_user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/sorbet-runtime-0.5.11311/lib/types/private/methods/_methods.rb:279:in `bind_call'
/Users/my_user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/sorbet-runtime-0.5.11311/lib/types/private/methods/_methods.rb:279:in `block in _on_method_added'
/Users/my_user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/ruby-lsp-rails-0.3.3/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb:16:in `new'
/Users/my_user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/ruby-lsp-rails-0.3.3/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb:16:in `create_client'
/Users/my_user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/sorbet-runtime-0.5.11311/lib/types/private/methods/_methods.rb:279:in `bind_call'
/Users/my_user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/sorbet-runtime-0.5.11311/lib/types/private/methods/_methods.rb:279:in `block in _on_method_added'
/Users/my_user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/ruby-lsp-rails-0.3.3/lib/ruby_lsp/ruby_lsp_rails/addon.rb:29:in `block in activate'
Server dependent features will not be available

As a test I created an empty Rails project, and Lsp-server correctly indexes the project

Been looking for a way to get more verbose output, especially to get the path of the file that LSP fails to index. Could you help me to do so?

Thanks!

andyw8 commented 3 months ago

Hi @bbouchet-trustpair,

From the logs this doesn't look related to indexing.

If you run bin/rails console does it start successfully?

bbouchet-trustpair commented 3 months ago

Hey @andyw8 thanks for your reply Yes rails' console (and server), run successfully.

andyw8 commented 3 months ago

(transferred to ruby-lsp-rails)

andyw8 commented 3 months ago

Do you have anywhere that prints to stdout while the app boots, e.g. a puts statement?

bbouchet-trustpair commented 3 months ago

Do you have anywhere that prints to stdout while the app boots, e.g. a puts statement?

Yes, there are a few puts statements. Is it not compatible?

andyw8 commented 3 months ago

This should be solved by https://github.com/Shopify/ruby-lsp-rails/pull/310 once released.

bbouchet-trustpair commented 3 months ago

Thank you @andyw8