mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 14:20:35 +01:00
[PR #1252] [MERGED] Adjust formatting of qualified access chains #970
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/apple/pkl/pull/1252
Author: @bioball
Created: 10/23/2025
Status: ✅ Merged
Merged: 10/25/2025
Merged by: @bioball
Base:
main← Head:qualified-access-chain-formatting-2📝 Commits (3)
6292719Adjust formatting of qualified access chains8c074d1Update pkl-parser/src/main/java/org/pkl/parser/GenericParser.java022a1b3Address PR comments📊 Changes
7 files changed (+275 additions, -53 deletions)
View changed files
📝
pkl-formatter/src/main/kotlin/org/pkl/formatter/Builder.kt(+143 -33)➕
pkl-formatter/src/test/files/FormatterSnippetTests/input/expr-chain-grouping.pkl(+31 -0)➕
pkl-formatter/src/test/files/FormatterSnippetTests/output/expr-chain-grouping.pkl(+65 -0)📝
pkl-parser/src/main/java/org/pkl/parser/GenericParser.java(+15 -10)📝
pkl-parser/src/main/java/org/pkl/parser/syntax/generic/NodeType.java(+1 -0)📝
pkl-parser/src/test/kotlin/org/pkl/parser/GenericSexpRenderer.kt(+4 -4)📝
pkl-parser/src/test/kotlin/org/pkl/parser/SexpRenderer.kt(+16 -6)📄 Description
This adjusts formatting of qualified access chains so that leading dot calls are kept in the same line if possible.
Formatting rules:
If there is a call chain that ends with the only method call, prefer to only wrap the argument list. Render this:
Instead of:
If the method call is interspersed within the chain, prefer to wrap before the first method call: Render this:
Instead of:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.