Architecture
March 23, 2026 ยท View on GitHub
High-Level Flow
- VS Code calls the document formatter provider.
- Extension reads workspace settings (
maxLineLength,dialect). formatExpression()performs dialect-aware parsing.- Parsed AST is sent to the deterministic printer.
- Printer returns canonical text; extension applies a full-document edit.
Dialect Pipeline
standard: strict JMESPath parse path.roarpath: preprocess~roots to$, parse with legacy literal support, print root as~.auto: trystandardfirst, fallback toroarpath.
This keeps parsing concerns isolated from printer concerns.
Formatter Invariants
- Idempotent output.
- Stable precedence and parentheses handling.
- Stable wrapping controlled by
maxLineLength. - No evaluation/runtime semantics in formatter logic.
Testing Strategy
- Fixture tests for canonical output.
- Behavior tests for dialect selection and edge-case handling.
- Explicit invalid-input coverage.
- Idempotency checks across fixture outputs.