Run ruby -c over the Ruby files you've changed, with one click, before you commit.
Built for Rails work: it asks git which files you touched, syntax-checks only those, and puts any errors in the Problems panel so you can jump straight to the bad line.
Click the check icon in the Activity Bar (left edge) to open the panel, then hit Check Changed Files. You also get:
- a Ruby item in the status bar — click it to run the same check
- a play button in the Source Control title bar
Ruby Syntax Check: Check Changed Ruby Filesin the Command Palette (Ctrl/Cmd+Shift+P)
"Changed" means anything git reports as different from HEAD: staged, unstaged, and
untracked new files. Deleted files are skipped. Results appear in the panel (click an
error to jump to it) and in the Problems panel.
| Setting | Default | What it does |
|---|---|---|
rubySyntaxCheck.rubyPath |
ruby |
How to invoke Ruby. Set a full path if the editor can't see your ruby. |
rubySyntaxCheck.rubyFiles |
.rb, .rake, .gemspec, .ru, Gemfile, Rakefile, Capfile, Guardfile |
What counts as Ruby. .foo matches an extension, anything else matches an exact file name. |
rubySyntaxCheck.includeUntracked |
true |
Also check new files git doesn't track yet. |
rubySyntaxCheck.checkOnSave |
false |
Re-check a Ruby file every time you save it. |
rubySyntaxCheck.showStatusBarItem |
true |
Show the status bar item. |
rubySyntaxCheck.maxParallel |
4 |
How many ruby -c processes run at once. |
Version managers (rbenv, rvm, asdf) usually work by patching your shell's PATH, and the
editor often doesn't inherit that. Run which ruby in a terminal and paste the result
into rubySyntaxCheck.rubyPath — e.g. ~/.rbenv/shims/ruby.
.erbtemplates.ruby -ccan't read them directly, and running them througherb -xshifts the line numbers enough that the reported lines would be wrong.- Style/lint. This is
ruby -conly — parse errors, nothing else. Use RuboCop for the rest. - Blocking commits. This is a button you press. If you want a check that runs on
every commit including from the terminal, use a git
pre-commithook instead — the extension can't intercept commits that don't go through the editor UI.
npm install
npm run watch # rebuild on changePress F5 to launch an Extension Development Host with the extension loaded.
npm run typecheck
npx @vscode/vsce package # produces a .vsix you can install locallyTo publish: set publisher in package.json to your marketplace publisher ID, then
vsce publish (VS Code Marketplace, which Cursor also reads) and ovsx publish for
Open VSX (VSCodium and friends).