Document Formatting¶
Automatically format your BerryCrush files for consistent style.
Formatting Commands¶
Format Entire Document¶
- Keyboard: Alt+Shift+F (Windows/Linux) or Option+Shift+F (macOS)
- Command Palette: Format Document
- Context Menu: Right-click → Format Document
Format Selection¶
- Keyboard: Ctrl+K Ctrl+F (Windows/Linux) or Cmd+K Cmd+F (macOS)
- Context Menu: Right-click → Format Selection
What Gets Formatted¶
Indentation¶
Steps and nested content are properly indented:
Before:
After:
Table Alignment¶
Data tables in examples: sections are aligned for readability:
Before:
After:
Whitespace Cleanup¶
- Removes trailing whitespace
- Normalizes blank lines
- Ensures proper spacing around operators
Configuration¶
Indent Size¶
Set the number of spaces per indent level:
Default: 2 spaces
Table Alignment¶
Enable or disable table column alignment:
Default: enabled
Format on Save¶
Enable automatic formatting when saving:
{
"editor.formatOnSave": true,
"[berrycrush-scenario]": {
"editor.formatOnSave": true
},
"[berrycrush-fragment]": {
"editor.formatOnSave": true
}
}
Format on Type¶
Format as you type (e.g., after pressing Enter):
Examples¶
Full Scenario Formatting¶
Before:
@smoke @api
scenario: Complete user workflow
given user data
body:
{"name":"John","email":"john@test.com"}
when creating user
call ^createUser
then user created
assert status 201
extract $.id => userId
and can retrieve
call ^getUser
|id|{{userId}}|
assert $.name equals "John"
After:
@smoke @api
scenario: Complete user workflow
given user data
body:
{"name":"John","email":"john@test.com"}
when creating user
call ^createUser
then user created
assert status 201
extract $.id => userId
and can retrieve
call ^getUser
| id | {{userId}} |
assert $.name equals "John"
Tips¶
- Format before committing code
- Use format on save for consistency
- Configure team-wide settings in
.vscode/settings.json
Related Features¶
- Syntax Highlighting - Visual structure
- Code Folding - Collapse formatted blocks