Rails view tooling for VS Code: one extension for ERB, Haml and Slim. It highlights your templates, finds errors as you type, formats them, and understands your Rails app: partials, components, helpers, routes, instance variables, translations and Stimulus controllers.
Built for Rails developers who work in app/views every day, and for teams that want the same template checks and formatting in the editor and in CI.
- No gems to install. The checks and the formatter are a fast language server written in Rust and bundled with the extension. They follow Erubi, Rails, Haml 7 and Slim 5 and report errors with those projects' own messages.
- Rails-aware. F12 on
render "users/card"opens the partial; completion knows your partials, ViewComponents, model columns,*_pathhelpers,@ivarsfrom the controller andt(".keys"). - Safe formatting. It changes only whitespace and checks that the template still compiles to the same thing; if it is unsure, it leaves the file alone.
- Works with Ruby LSP. Install both: Ruby LSP keeps your
.rbfiles, this extension adds what templates need.
- Install Ruby Templates from the VS Code Marketplace or Open VSX.
- Open a Rails project and any view. That's it: highlighting, checks, navigation and formatting work immediately.
- Optional: turn on format on save, e.g.
"[erb]": { "editor.formatOnSave": true }(also[haml],[slim]).
Requires VS Code 1.100 or newer, on Linux (x64, arm64), macOS (Apple silicon, Intel) or Windows (x64).
The full documentation is at x-ror.github.io/vscode-ruby-templates:
- Getting started
- Guides: errors as you type, Rails navigation and completion, file types, formatting, commands, command line for CI, settings, supported syntax, compatibility and troubleshooting
- Diagnostics reference: every check, with its code
- Rules and
.ruby-templates.toml: turn checks off per project, folder or file; it wins over the VS Code settings - Changelog
Contributing covers building, testing and the project layout. Found a bug or missing a Rails feature? Open an issue.