[PR #1107] [MERGED] Formatter #891

Closed
opened 2025-12-30 01:27:35 +01:00 by adam · 0 comments
Owner

📋 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: mainHead: formatter


📝 Commits (10+)

📊 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.

## 📋 Pull Request Information **Original PR:** https://github.com/apple/pkl/pull/1107 **Author:** [@stackoverflow](https://github.com/stackoverflow) **Created:** 6/24/2025 **Status:** ✅ Merged **Merged:** 9/17/2025 **Merged by:** [@stackoverflow](https://github.com/stackoverflow) **Base:** `main` ← **Head:** `formatter` --- ### 📝 Commits (10+) - [`04f28be`](https://github.com/apple/pkl/commit/04f28be52f8bc84d8ded4a053f6aaa4c14d21c0e) Introduce generic parser which keeps affixes in the ast - [`720e6f3`](https://github.com/apple/pkl/commit/720e6f3ca2efb80eef3a5fd5352807ad83c6f8f2) Add tests to generic parser - [`fef006e`](https://github.com/apple/pkl/commit/fef006e72acec1a52c77769c64271fca4ddcdcc8) Start formatter - [`47d86ca`](https://github.com/apple/pkl/commit/47d86ca87b29d5bb497bcfdb80663940745a5b53) Format imports - [`beac022`](https://github.com/apple/pkl/commit/beac022cf44eca6ba22f8d73f1f9f66b317e7568) Use intermediary formatting tree - [`a39c106`](https://github.com/apple/pkl/commit/a39c106519ce0799e9d0c1a3e7b91975838f155f) Add formatter snippet tests - [`69e02b5`](https://github.com/apple/pkl/commit/69e02b54539e25ed973687e3b3b294216df6e155) Add more snippet tests - [`0f107e5`](https://github.com/apple/pkl/commit/0f107e58eb0613ab606652a256274c6d3c4f76a8) More snippets - [`d7b646b`](https://github.com/apple/pkl/commit/d7b646bacf48888b5dd0c4cd41a4a3d62c850293) More formated nodes - [`f484c5c`](https://github.com/apple/pkl/commit/f484c5c5ce0d9f69bf71a04f01b19bf59a6f7925) More formated nodes ### 📊 Changes **78 files changed** (+5491 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `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_ </details> ### 📄 Description This is a draft for the canonical Pkl formatter based on this SPICE: https://github.com/apple/pkl-evolution/pull/15 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 01:27:35 +01:00
adam closed this issue 2025-12-30 01:27:36 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#891