
MAA Pipeline Formatter
A specialized JSON formatter for MaaFramework Pipeline files, featuring intelligent structure-aware formatting and comment preservation.
1. Features
- 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.
2. How to Use
2.1 Installation
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 (or Ctrl + Shift + Alt + F depending on your keybindings).
- Command Palette:
Ctrl + Shift + P -> Format Document.
- Right Click: Select
Format Document in the editor context menu.
2.3 Configuration
This extension uses a standalone configuration file instead of VS Code settings for formatting rules.
Configuration Priority:
.maapipeline-format in the workspace root.
.vscode/maapipeline-format in 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
3. Feedback & Contributions
4. Acknowledgments
4.1 Open Source Projects
- MaaFramework
- MaaPipeline-Format-VSCode