Implement Jai formatter

This commit is contained in:
hgranthorner
2026-08-06 11:10:07 -04:00
parent 065e0b0bf4
commit 427269ad78
5 changed files with 432 additions and 17 deletions

View File

@@ -61,7 +61,7 @@ Last verified state (all green, `./jaigradle check` and `verifyPlugin` too):
```text
dev.hgh.HarnessSmokeTest tests=2
dev.hgh.jai.JaiFileTypeTest tests=4
dev.hgh.jai.completion.JaiCompletionTest tests=19
dev.hgh.jai.completion.JaiCompletionTest tests=20
dev.hgh.jai.editor.JaiEditorSupportTest tests=7
dev.hgh.jai.editor.JaiFoldingBuilderTest tests=3
dev.hgh.jai.findusages.JaiFindUsagesTest tests=2
@@ -73,11 +73,12 @@ dev.hgh.jai.parser.JaiParserGoldenTest tests=5 <- Tier 2 golden trees
dev.hgh.jai.parser.JaiParserLongTailTest tests=1 <- focused parser regressions
dev.hgh.jai.parser.DebugParseTest tests=2 <- scratch harness, inert
dev.hgh.jai.refactoring.JaiRenameTest tests=3
dev.hgh.jai.reference.JaiReferenceTest tests=9
dev.hgh.jai.reference.JaiReferenceTest tests=10
dev.hgh.jai.structure.JaiStructureViewTest tests=3
dev.hgh.jai.formatter.JaiFormatterTest tests=4
dev.hgh.jai.settings.JaiProjectSettingsTest tests=3
dev.hgh.jai.settings.JaiConfiguredRootTest tests=6
-> total 93, failures+errors 0
-> total 99, failures+errors 0
```
The corpus gates report what they actually did; check both lines are still there:
@@ -129,6 +130,10 @@ Tier 3: parsed 714 files, 714 clean (100.0%), 0 with errors, 0 PsiErrorElements
sources. Headless tests cover state round-tripping, the Settings panel,
custom-root `#import`/`#load` navigation and completion, and cross-root
find-usages.
- **Phase 6** — PSI-aware formatter with operator/punctuation spacing,
block indentation, opaque `#asm` preservation, and a corpus-wide idempotence
gate. Headless formatter tests cover registration, representative formatting,
opaque/directive token preservation, and all 714 corpus files.
### Lexer design facts worth knowing before touching it
@@ -197,16 +202,14 @@ Tier 3: parsed 714 files, 714 clean (100.0%), 0 with errors, 0 PsiErrorElements
### In progress — pick up here
1. **Phases 6+** formatter, inspections, compiler integration, and other
optional work remain. `#asm` bodies are intentionally consumed opaquely, so
nothing inside them has PSI yet.
1. **Phases 7+** — inspections, compiler integration, and other optional work
remain. `#asm` bodies are intentionally consumed opaquely, so nothing inside
them has PSI yet.
### Next planned increment
- Decide whether to continue with the optional formatter, inspections, and
compiler integration phases (68).
- If formatter work begins, add the corpus-wide idempotence gate described in
`docs/BUILD_PLAN.md` before changing formatting behavior.
- Decide whether to continue with inspections and compiler integration phases
(78).
### Open questions for the user (unanswered)