Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,19 @@ All boolean, string, and integer [`bsfmt.json`](#bsfmtjson-options) options are
|formatInteriorWhitespace|`boolean`|`true`| All whitespace between items is reduced to exactly 1 space character and certain keywords and operators are padded with whitespace. This is a catchall property that will also disable the following rules: `insertSpaceBeforeFunctionParenthesis`, `insertSpaceBetweenEmptyCurlyBraces` `insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces`|
|insertSpaceBeforeFunctionParenthesis|`boolean`|`false`| If true, a space is inserted to the left of an opening function declaration parenthesis. (i.e. `function main ()` or `function ()`). If false, all spacing is removed (i.e. `function main()` or `function()`).|
|insertSpaceBetweenEmptyCurlyBraces|`boolean`|`false`| If true, empty curly braces will contain exactly 1 whitespace char (i.e. `{ }`). If false, there will be zero whitespace chars between empty curly braces (i.e. `{}`) |
|insertSpaceAfterConditionalCompileSymbol|`boolean`|`false`| If true, ensure exactly 1 space between `#` and the keyword (i.e. `# if true`). If false, remove all whitespace between `#` and the keyword (i.e. `#if true`)|
|insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces|`boolean`|`true`| If true, ensure exactly 1 space after leading and before trailing curly braces. If false, REMOVE all whitespace after leading and before trailing curly braces (excluding beginning-of-line indentation spacing)|
|insertSpaceBetweenAssociativeArrayLiteralKeyAndColon|`boolean`|`false`| If true, ensure exactly 1 space between an associative array literal key and its colon. If false, all space between the key and its colon will be removed |
|formatSingleLineCommentType|`"singlequote", "rem", "original"`| `"original"` | Forces all single-line comments to use the same style. If 'singlequote' or falsey, all comments are preceeded by a single quote. This is the default. If `"rem"`, all comments are preceeded by `rem`. If `"original"`, the comment type is unchanged|
|formatMultiLineObjectsAndArrays|`boolean`| `true`|For multi-line objects and arrays, move everything after the `{` or `[` and everything before the `}` or `]` onto a new line.`|
|sortImports|`boolean`| `false`|Sort imports alphabetically.`|
|trailingComma| `"always", "allButLast", "never", "original"` | `"original"` | Controls commas on items of multi-line arrays and associative arrays. `"always"`: every item gets a trailing comma (including the last). `"allButLast"`: every item except the last gets a comma (conventional style). `"never"`: all item commas are removed. `"original"`: commas are not modified. Has no effect on single-line arrays or AAs.|
|maxConsecutiveEmptyLines|`number`|`undefined`| Collapse runs of consecutive blank lines down to at most this many. For example, `1` collapses three blank lines in a row into one. When omitted, blank lines are not modified.|
|singleLineIf|`"inline", "inlineNoElseIf", "inlineNoElse", "block", "original"`|`"original"`| Controls how `if` statements are formatted. `"inline"`: collapse to inline form whenever the body fits on one line, including ifs with `else` and `else if` chains. `"inlineNoElseIf"`: collapse to inline form, but ifs with an `else if` chain stay in block form. `"inlineNoElse"`: only collapse simple `if/then` ifs that have no `else` at all. `"block"`: always use multi-line block form (expand inline ifs to `if/then/end if`). `"original"`: leave each if as written.|
|inlineArrayAndObject|`"always", "never", "fitsLine", "original"`|`"original"`| Controls how arrays and associative arrays are formatted across lines. `"always"`: collapse multi-line literals to one line (regardless of length). `"never"`: expand single-line literals to multi-line. `"fitsLine"`: collapse only when the resulting line fits within `maxLineLength`; falls back to `"always"` when `maxLineLength` is unset. `"original"`: leave each literal as written. Literals containing line comments, `bs:disable-line` directives, conditional-compile directives, regex literals, or items whose value spans multiple physical lines are never collapsed.|
|maxLineLength|`number`|`undefined`| Target maximum line length, in characters. Currently consumed by `inlineArrayAndObject: "fitsLine"` to decide whether collapsing keeps a line within budget. Reserved for future length-aware rules.|
|blockSpacing|`"before", "after", "between", "always", "original", { default?, function?, sub?, if?, for?, while?, try? }`|`"original"`| Controls blank-line spacing around block constructs. String form applies the same policy to every supported block. `"before"` ensures a blank line above the block. `"after"` ensures a blank line below the block. `"between"` ensures both. `"always"` adds inner-body padding too (blank line at start and end of body). `"original"` leaves spacing alone. Inline ifs (and inline else branches) are not blocks and are skipped. Leading line comments immediately above an opener are treated as part of the block — the blank line lands above the comment, not between comment and opener. Trailing comments immediately after a closer attach to the closer. Spacing is suppressed when the construct is the first or last thing in its parent's body. Object form allows per-construct overrides; constructs not listed fall back to `default` (or `"original"` if `default` is also omitted). `if` covers the entire if/else if/else chain. `for` covers `for` and `for each`. `try` covers the entire try/catch construct. Example: `{ default: "between", function: "always" }`.|
|alignAssignments|`boolean`|`false`| If true, align the `=` sign in consecutive simple assignment statements by padding the left-hand side with spaces. Alignment resets after a blank line or a non-assignment statement.|
|sortImports|`boolean`| `false`|Sort imports alphabetically.|

### keywordCaseOverride
For more flexibility in how to format the case of keywords, you can specify the case preference for each individual keyword. Here's an example:
Expand Down
Loading
Loading