[PR #1235] [MERGED] Format lambda chains #956

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

📋 Pull Request Information

Original PR: https://github.com/apple/pkl/pull/1235
Author: @bioball
Created: 10/9/2025
Status: Merged
Merged: 10/9/2025
Merged by: @bioball

Base: mainHead: format-lambda-chains


📝 Commits (3)

  • 799fdfe Only force line on multiple lambda chains
  • cd79610 dont keep counting if already past max
  • 85b8b1c fn rename

📊 Changes

3 files changed (+18 additions, -2 deletions)

View changed files

📝 pkl-formatter/src/main/kotlin/org/pkl/formatter/Builder.kt (+14 -2)
📝 pkl-formatter/src/test/files/FormatterSnippetTests/input/expr-chain.pkl (+2 -0)
📝 pkl-formatter/src/test/files/FormatterSnippetTests/output/expr-chain.pkl (+2 -0)

📄 Description

This changes the formatter to only force line on call chains
with multiple lambdas

With this change, this is kept as a single line:

foo.bar.map((it) -> it + 1)

This is broken into multiple lines, because there are two lambdas:

foo.bar.map((it) -> it + 1).filter((it) -> it.isEven)

🔄 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/1235 **Author:** [@bioball](https://github.com/bioball) **Created:** 10/9/2025 **Status:** ✅ Merged **Merged:** 10/9/2025 **Merged by:** [@bioball](https://github.com/bioball) **Base:** `main` ← **Head:** `format-lambda-chains` --- ### 📝 Commits (3) - [`799fdfe`](https://github.com/apple/pkl/commit/799fdfe803ac41aa7b9614bcd2ef30d5c31a4ee8) Only force line on multiple lambda chains - [`cd79610`](https://github.com/apple/pkl/commit/cd79610a7d549f67c297d1d0832dc67b7f20df75) dont keep counting if already past max - [`85b8b1c`](https://github.com/apple/pkl/commit/85b8b1c317956200db3d21833c24f936b642ba02) fn rename ### 📊 Changes **3 files changed** (+18 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `pkl-formatter/src/main/kotlin/org/pkl/formatter/Builder.kt` (+14 -2) 📝 `pkl-formatter/src/test/files/FormatterSnippetTests/input/expr-chain.pkl` (+2 -0) 📝 `pkl-formatter/src/test/files/FormatterSnippetTests/output/expr-chain.pkl` (+2 -0) </details> ### 📄 Description This changes the formatter to only force line on call chains with multiple lambdas With this change, this is kept as a single line: ``` foo.bar.map((it) -> it + 1) ``` This is broken into multiple lines, because there are two lambdas: ``` foo.bar.map((it) -> it + 1).filter((it) -> it.isEven) ``` --- <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:57 +01:00
adam closed this issue 2025-12-30 01:27:57 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#956