Original PR: https://github.com/apple/pkl/pull/1107 Author: @stackoverflow Created: 6/24/2025 Status: ✅ Merged Merged: 9/17/2025 Merged by: @stackoverflow
Base: main ← Head: formatter
main
formatter
04f28be
720e6f3
fef006e
47d86ca
beac022
a39c106
69e02b5
0f107e5
d7b646b
f484c5c
78 files changed (+5491 additions, -26 deletions)
📝 docs/modules/pkl-cli/pages/index.adoc (+27 -0) 📝 pkl-cli/pkl-cli.gradle.kts (+1 -0) ➕ pkl-cli/src/main/kotlin/org/pkl/cli/CliFormatterApply.kt (+52 -0) ➕ pkl-cli/src/main/kotlin/org/pkl/cli/CliFormatterCheck.kt (+43 -0) ➕ pkl-cli/src/main/kotlin/org/pkl/cli/CliFormatterCommand.kt (+53 -0) ➕ pkl-cli/src/main/kotlin/org/pkl/cli/commands/FormatterCommand.kt (+71 -0) 📝 pkl-cli/src/main/kotlin/org/pkl/cli/commands/RootCommand.kt (+1 -0) ➕ pkl-formatter/gradle.lockfile (+36 -0) ➕ pkl-formatter/pkl-formatter.gradle.kts (+48 -0) ➕ pkl-formatter/src/main/kotlin/org/pkl/formatter/Builder.kt (+1258 -0) ➕ pkl-formatter/src/main/kotlin/org/pkl/formatter/Formatter.kt (+53 -0) ➕ pkl-formatter/src/main/kotlin/org/pkl/formatter/Generator.kt (+149 -0) ➕ pkl-formatter/src/main/kotlin/org/pkl/formatter/NaturalOrderComparator.kt (+66 -0) ➕ pkl-formatter/src/main/kotlin/org/pkl/formatter/ast/FormatNode.kt (+66 -0) ➕ pkl-formatter/src/test/files/FormatterSnippetTests/input/class-bodies.pkl (+10 -0) ➕ pkl-formatter/src/test/files/FormatterSnippetTests/input/comma-termination.pkl (+16 -0) ➕ pkl-formatter/src/test/files/FormatterSnippetTests/input/comment-interleaved.pkl (+31 -0) ➕ pkl-formatter/src/test/files/FormatterSnippetTests/input/dangling-doc-comment.pkl (+8 -0) ➕ pkl-formatter/src/test/files/FormatterSnippetTests/input/doc-comments.pkl (+14 -0) ➕ pkl-formatter/src/test/files/FormatterSnippetTests/input/expr-binary.pkl (+25 -0)
docs/modules/pkl-cli/pages/index.adoc
pkl-cli/pkl-cli.gradle.kts
pkl-cli/src/main/kotlin/org/pkl/cli/CliFormatterApply.kt
pkl-cli/src/main/kotlin/org/pkl/cli/CliFormatterCheck.kt
pkl-cli/src/main/kotlin/org/pkl/cli/CliFormatterCommand.kt
pkl-cli/src/main/kotlin/org/pkl/cli/commands/FormatterCommand.kt
pkl-cli/src/main/kotlin/org/pkl/cli/commands/RootCommand.kt
pkl-formatter/gradle.lockfile
pkl-formatter/pkl-formatter.gradle.kts
pkl-formatter/src/main/kotlin/org/pkl/formatter/Builder.kt
pkl-formatter/src/main/kotlin/org/pkl/formatter/Formatter.kt
pkl-formatter/src/main/kotlin/org/pkl/formatter/Generator.kt
pkl-formatter/src/main/kotlin/org/pkl/formatter/NaturalOrderComparator.kt
pkl-formatter/src/main/kotlin/org/pkl/formatter/ast/FormatNode.kt
pkl-formatter/src/test/files/FormatterSnippetTests/input/class-bodies.pkl
pkl-formatter/src/test/files/FormatterSnippetTests/input/comma-termination.pkl
pkl-formatter/src/test/files/FormatterSnippetTests/input/comment-interleaved.pkl
pkl-formatter/src/test/files/FormatterSnippetTests/input/dangling-doc-comment.pkl
pkl-formatter/src/test/files/FormatterSnippetTests/input/doc-comments.pkl
pkl-formatter/src/test/files/FormatterSnippetTests/input/expr-binary.pkl
...and 58 more files
This is a draft for the canonical Pkl formatter based on this SPICE: https://github.com/apple/pkl-evolution/pull/15
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
No dependencies set.
The note is not visible to the blocked user.
📋 Pull Request Information
Original PR: https://github.com/apple/pkl/pull/1107
Author: @stackoverflow
Created: 6/24/2025
Status: ✅ Merged
Merged: 9/17/2025
Merged by: @stackoverflow
Base:
main← Head:formatter📝 Commits (10+)
04f28beIntroduce generic parser which keeps affixes in the ast720e6f3Add tests to generic parserfef006eStart formatter47d86caFormat importsbeac022Use intermediary formatting treea39c106Add formatter snippet tests69e02b5Add more snippet tests0f107e5More snippetsd7b646bMore formated nodesf484c5cMore formated nodes📊 Changes
78 files changed (+5491 additions, -26 deletions)
View changed files
📝
docs/modules/pkl-cli/pages/index.adoc(+27 -0)📝
pkl-cli/pkl-cli.gradle.kts(+1 -0)➕
pkl-cli/src/main/kotlin/org/pkl/cli/CliFormatterApply.kt(+52 -0)➕
pkl-cli/src/main/kotlin/org/pkl/cli/CliFormatterCheck.kt(+43 -0)➕
pkl-cli/src/main/kotlin/org/pkl/cli/CliFormatterCommand.kt(+53 -0)➕
pkl-cli/src/main/kotlin/org/pkl/cli/commands/FormatterCommand.kt(+71 -0)📝
pkl-cli/src/main/kotlin/org/pkl/cli/commands/RootCommand.kt(+1 -0)➕
pkl-formatter/gradle.lockfile(+36 -0)➕
pkl-formatter/pkl-formatter.gradle.kts(+48 -0)➕
pkl-formatter/src/main/kotlin/org/pkl/formatter/Builder.kt(+1258 -0)➕
pkl-formatter/src/main/kotlin/org/pkl/formatter/Formatter.kt(+53 -0)➕
pkl-formatter/src/main/kotlin/org/pkl/formatter/Generator.kt(+149 -0)➕
pkl-formatter/src/main/kotlin/org/pkl/formatter/NaturalOrderComparator.kt(+66 -0)➕
pkl-formatter/src/main/kotlin/org/pkl/formatter/ast/FormatNode.kt(+66 -0)➕
pkl-formatter/src/test/files/FormatterSnippetTests/input/class-bodies.pkl(+10 -0)➕
pkl-formatter/src/test/files/FormatterSnippetTests/input/comma-termination.pkl(+16 -0)➕
pkl-formatter/src/test/files/FormatterSnippetTests/input/comment-interleaved.pkl(+31 -0)➕
pkl-formatter/src/test/files/FormatterSnippetTests/input/dangling-doc-comment.pkl(+8 -0)➕
pkl-formatter/src/test/files/FormatterSnippetTests/input/doc-comments.pkl(+14 -0)➕
pkl-formatter/src/test/files/FormatterSnippetTests/input/expr-binary.pkl(+25 -0)...and 58 more files
📄 Description
This is a draft for the canonical Pkl formatter based on this SPICE: https://github.com/apple/pkl-evolution/pull/15
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.