mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 22:30:54 +01:00
[PR #1247] [MERGED] Format interpolated expressions as single line #966
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/1247
Author: @bioball
Created: 10/21/2025
Status: ✅ Merged
Merged: 10/24/2025
Merged by: @bioball
Base:
main← Head:string-interpolation-formatting📝 Commits (3)
a313e24Format interpolated expressions as single linecc4343eFix formatting when leading/trailing comments are present2d22e09Adjustments📊 Changes
12 files changed (+355 additions, -126 deletions)
View changed files
📝
pkl-formatter/src/main/kotlin/org/pkl/formatter/Builder.kt(+222 -102)📝
pkl-formatter/src/main/kotlin/org/pkl/formatter/Generator.kt(+0 -6)📝
pkl-formatter/src/main/kotlin/org/pkl/formatter/ast/FormatNode.kt(+5 -7)➕
pkl-formatter/src/test/files/FormatterSnippetTests/input/single-line-strings.pkl(+7 -0)➕
pkl-formatter/src/test/files/FormatterSnippetTests/input/string-interpolation.pkl(+51 -0)📝
pkl-formatter/src/test/files/FormatterSnippetTests/output/multi-line-strings.pkl(+1 -3)➕
pkl-formatter/src/test/files/FormatterSnippetTests/output/single-line-strings.pkl(+9 -0)➕
pkl-formatter/src/test/files/FormatterSnippetTests/output/string-interpolation.pkl(+52 -0)📝
pkl-parser/src/main/java/org/pkl/parser/GenericParser.java(+3 -3)📝
pkl-parser/src/main/java/org/pkl/parser/syntax/generic/NodeType.java(+1 -1)📝
pkl-parser/src/test/kotlin/org/pkl/parser/GenericSexpRenderer.kt(+2 -2)📝
pkl-parser/src/test/kotlin/org/pkl/parser/SexpRenderer.kt(+2 -2)📄 Description
This forces iterpolated expressions to be single-line, so that newline literals within the bounds of two string delimiters can be seen as verbatim newlines in the resulting string.
Edge case: in the case of a line comment, it's not possible to keep this as a single line expression.
These are kept as multi-line expressions.
Also:
ForceWrap, this node is not used.StringConstant->StringChars🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.