A specialized JSON formatter for MaaFramework Pipeline files, featuring intelligent structure-aware formatting and comment preservation.
- Structure-Aware Formatting: Automatically keeps coordinate arrays (e.g.,
roi,target) and short control flows inline, while expanding complex parameter objects. - Comment Preservation: Full support for JSONC (JSON with comments). Comments are preserved and intelligently indented.
- Configurable: Fully customizable formatting rules via a standalone configuration file.
Search for MAA Pipeline Formatter in the VS Code Marketplace and install it.
Open any .json file related to MaaFramework (e.g., pipeline.json, task.json).
- Shortcut:
Shift + Alt + F(orCtrl + Shift + Alt + Fdepending on your keybindings). - Command Palette:
Ctrl + Shift + P->Format Document. - Right Click: Select
Format Documentin the editor context menu.
This extension uses a standalone configuration file instead of VS Code settings for formatting rules.
Configuration Priority:
.maapipeline-formatin the workspace root..vscode/maapipeline-formatin the workspace root.
Auto-Generation:
If no configuration file is found when you trigger formatting, the extension will automatically generate a default configuration file at .vscode/maapipeline-format.
Configuration Example:
{
"version": "1.0",
"indent": {
"style": "tab", // or "space"
"width": 1
},
"posix": {
"insert_final_newline": false
},
"formatting": {
// Keep arrays in single rows if their length is less than this value and their structure is simple.
"simple_array_threshold": 50,
"coordinate_fields": [
"roi",
"roi_offset",
"target",
"target_offset",
"begin",
"begin_offset",
"end",
"end_offset",
"lower",
"upper"
],
"control_flow_fields": [
"next",
"interrupt",
"on_error",
"template"
],
"always_multiline_fields": [
"custom_action_param",
"custom_param",
"parameters",
"params",
"options",
"config"
]
},
"file_handling": {
"preserve_comments": true,
"output_suffix": "",
"encoding": "utf-8",
"newline": "LF"
}
}By default, Format On Save is disabled to prevent accidental changes. To enable it, add the following to your VS Code settings.json:
"maapipeline-format.enableFormatOnSave": true- Submit Issues
- QQ Group:
720731834