ruby-lsp-rails icon indicating copy to clipboard operation
ruby-lsp-rails copied to clipboard

Running in Docker

Open obahareth opened this issue 1 year ago • 3 comments

Hey,

I have Ruby LSP working just fine via ASDF on my local machine (macOS) on VS Code, but none of the Rails features are working. I don't use any of the VS Code remote features, I run docker compose up in my terminal. The documentation says that the Rails LSP should just work "automatically".

What's the process like for getting it running in Docker Compose, do I need to add anything to my project's gemfile?

Does the gem need to be able to hook into my Rails app/server somehow?

obahareth avatar Dec 07 '24 08:12 obahareth

Hi @obahareth

For the Rails features, the add-on communicates with your app via the Rails runner command. If you try run bin/rails runner 'puts 1' locally and it fails, then the Rails add-on features won't work either.

See Developing inside a Container for the supported approach.

andyw8 avatar Dec 09 '24 13:12 andyw8

Hey @andyw8, thanks for your quick response!

Is there any way I can give it a custom command to do something like docker compose run my_app rails runner?

VS Code's version of this seems like a major flow change. My editor currently has 0 interaction with my container, everything happens via the terminal.

obahareth avatar Dec 11 '24 18:12 obahareth

We don't offer a way to change this, it's set here:

https://github.com/Shopify/ruby-lsp-rails/blob/955dc27e44c015f5839a438d37b03a64f2cb1642/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#L74

andyw8 avatar Dec 11 '24 19:12 andyw8