Is there good autocomplete/intellisense for Rails development?

Are there any plugins you use to for vscode-like intellisense/autocomplete? And not just a generic one, but rather has context of the project you’re working on, for example:

  1. Suggests helper functions
  2. Suggests Model names and their child methods/properties
  3. Shows inline errors if accessing a field not present on a model

basically how a language server works, but for your rails app? I think the best comparision I have is Rust Analyzer but for Rails

Personally I’m quite happy with Jetbrains IntelliJ IDEA’ Ruby plugin (= same experience as when buying RubyMine directly, I just use IntelliJ for historical reasons as I come from Java development). The experience overall has been positive. I did not really compare with VSCode however.

  1. in a quick test it suggests helpers but some seem missing, but for me it’s been good enough
  2. yes, seems to work
  3. yes, there is a squiggle under the field name with the message “Cannot find ‘foo’ for type ‘Model’”
2 Likes

Ruby has several LSP servers including

From my experience, none of them provides perfect completions. Rails doesn’t have fully prepared types, so type system doesn’t help us a lot.

You can use ctags to get TAG files and use it for completion with your editor plugin.

1 Like

I’ve been using vs code with solargraph and tabnine, it’s not perfect but makes writing code much easier.

1 Like

I use JetBrains RubyMine and couldn’t be happier. It’s the bomb.

What about ‘Ruby LSP’. There is even official documentation on the Visual Studio Code website:

I couldn’t get it to work with GitHub - rails/docked: Running Rails from Docker for easy start to development