Skip to content

Repository files navigation

Ruby Syntax Check

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.

Using it

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 Files in 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.

Settings

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.

If it says "Ruby not found"

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.

What it doesn't do

  • .erb templates. ruby -c can't read them directly, and running them through erb -x shifts the line numbers enough that the reported lines would be wrong.
  • Style/lint. This is ruby -c only — 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-commit hook instead — the extension can't intercept commits that don't go through the editor UI.

Developing

npm install
npm run watch     # rebuild on change

Press F5 to launch an Extension Development Host with the extension loaded.

npm run typecheck
npx @vscode/vsce package   # produces a .vsix you can install locally

To 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).

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages