Skip to content
| Marketplace
Sign in
Visual Studio Code>Linters>Rails ExtensionsNew to Visual Studio Code? Get it now.
Rails Extensions

Rails Extensions

auslach

|
1 install
| (0) | Free
Extensions for Rails development.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Rails Strict Locals Linter Extension

This repository contains a minimal Visual Studio Code extension that lints Rails partials for strict local declarations. The linter checks the first line of each Rails partial (files named _*.html.erb) for a locals comment in the form:

<%# locals: (var_one:, var_two: "Default Var Two") %>

If the comment is missing or malformed, a warning diagnostic is displayed.

Usage

  1. Open this folder in VS Code (or Cursor).
  2. Run Extensions: Show Built-in Extensions and load this extension in development mode (use F5 in VS Code).

The extension activates for files with the erb language or .erb extension and updates diagnostics when documents are opened, changed, or saved. Only Rails partials named _*.html.erb are linted.

Development

Run the built-in tests with:

npm test

Testing the extension locally

The following steps let you try the linter against the example ERB files in test/fixtures while developing:

  1. Open the repository in VS Code.
  2. Press F5 to start an Extension Development Host window. This window loads the extension from source.
  3. In the new window choose File → Add Folder to Workspace… and select the test/fixtures directory.
  4. Open the fixture partials:
    • _valid.html.erb should show no warnings.
    • _missing_comment.html.erb should warn about a missing locals comment.
    • _invalid_syntax.html.erb should warn about invalid locals syntax.
  5. Edit the first line of any file and save to see diagnostics update immediately.
  6. Close the development host window when finished.

Publishing to the VS Code Marketplace

Install the vsce utility and publish using your Marketplace publisher account:

npm install -g vsce
vsce package         # create a .vsix file
vsce publish         # publish to the Marketplace
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft