Modes
default mode
Section titled “default mode”Moves {, }, ;, and trailing , to the right margin. Source semantics are completely untouched — the formatted file is identical in behaviour to the original.
// inputfunction greet(name) { if (!name) { return "hello"; } return `hi, ${name}`;}// default mode outputfunction greet(name) { if (!name) { return "hello"; } return `hi, ${name}`; }ruby mode
Section titled “ruby mode”Everything default does, plus:
- A synthetic
endline is injected after each closing brace, matching the indentation of the block it closes. - A variable declaration is injected right after the first
{(so the file still executes without errors).
// ruby mode outputfunction greet(name) { let end=null; if (!name) { return "hello"; } end return `hi, ${name}`; }endsmartEnd
Section titled “smartEnd”When ruby.smartEnd is true (the default), end is not inserted before these continuation keywords:
elsecatchfinallywhile(do…while)
variableName
Section titled “variableName”Change the injected identifier via ruby.variableName:
{ "ruby": { "variableName": "_end" } }injectDeclaration
Section titled “injectDeclaration”Set to false to skip the variable declaration injection (useful if you’re formatting a snippet that isn’t a standalone file).
Plugin ruby mode
Section titled “Plugin ruby mode”Each plugin declares whether it supports ruby mode. For plugins that do, the declaration template is language-appropriate:
| Plugin | Declaration |
|---|---|
| (core) | let end=null; |
@indentier/plugin-rust | const end:()=(); |
@indentier/plugin-go | var end any=nil |
@indentier/plugin-c | void*end=0; |
@indentier/plugin-php | $end=null; |