Skip to content

About

Rails view tooling for VS Code: ERB, Haml and Slim highlighting, live errors, safe formatting, Rails-aware navigation

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Ruby Templates

Ruby Templates: ERB, Haml, Slim

VS Marketplace Open VSX npm Socket build License: MIT

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, *_path helpers, @ivars from the controller and t(".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 .rb files, this extension adds what templates need.

Getting started

  1. Install Ruby Templates from the VS Code Marketplace or Open VSX.
  2. Open a Rails project and any view. That's it: highlighting, checks, navigation and formatting work immediately.
  3. 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).

Documentation

The full documentation is at x-ror.github.io/vscode-ruby-templates:

Contributing covers building, testing and the project layout. Found a bug or missing a Rails feature? Open an issue.

License

MIT

About

Rails view tooling for VS Code: ERB, Haml and Slim highlighting, live errors, safe formatting, Rails-aware navigation

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages