Ruby on Micro
Ctrl/Cmd-click a Ruby use-case reference such as:
use_case('use_cases.orders.create').execute(payload)
The extension opens:
app/use_cases/orders/create.rb
The same works for blueprints and steps imported through a Ruby configuration import:
include Config::Import['blueprints.invoice_blueprint']
include Config::Import[
publish_created: 'steps.orders.publish_created'
]
These open app/blueprints/invoice_blueprint.rb and
app/steps/orders/publish_created.rb respectively.
Ruby constants are also supported. Ctrl/Cmd-clicking:
Constants::ErrorCodes::AUTH_SIGNATURE_INVALID
opens config/constants/error_codes.rb and jumps to the line where
AUTH_SIGNATURE_INVALID is defined, including constants declared with
define :AUTH_SIGNATURE_INVALID, ....
Run locally
- Open this directory in VS Code.
- Run
npm install.
- Run
npm run compile.
- Press
F5 to launch an Extension Development Host.
- Open the Ruby project you want to work on in that new window.
- Open a Ruby file containing a configured reference.
- Ctrl/Cmd-click the reference.
Configure rubyOnMicro.referenceRoots when a repository stores
its implementation directories somewhere other than app. Configure
rubyOnMicro.constantRoots when constant files are stored somewhere other
than config/constants.
Open a repository
Press Cmd+Shift+O on macOS (Ctrl+Shift+O on Windows/Linux), or run
Ruby on Micro: Open Repository from the Command Palette. The extension
shows Git repositories directly inside the configured parent folder in a
centered Quick Pick window and opens the selected repository.
Each repository item shows its Git branch and status instead of the directory
path, including changed-file counts, staged/unstaged/untracked changes, and
ahead/behind counts when available.
Press Cmd+Shift+T on macOS (Ctrl+Shift+T on Windows/Linux), or run
Ruby on Micro: Open Repository Terminal from the Command Palette. It uses the
same repository picker and opens a VS Code integrated terminal at the selected
repository directory, using zsh on macOS.
The first time, the extension asks for the parent folder and saves it. To
change it later, run Ruby on Micro: Configure Repository Folder from the
Command Palette, or edit rubyOnMicro.repositoriesDirectory in Settings.
Repositories already open in the current VS Code window are marked with a
check icon. VS Code extensions cannot switch focus to a repository opened in a
different OS window, but selecting it will open the folder normally.