Leading/trailing line comments surrounding a lambda should make that lambda not "trailing", because the formatting otherwise looks bad and also isn't stable
Fix incorrect algorithm for detecting trailing lambda (currently, any number of lambdas makes the alg return true)
🔄 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/1283
**Author:** [@bioball](https://github.com/bioball)
**Created:** 11/3/2025
**Status:** ✅ Merged
**Merged:** 11/3/2025
**Merged by:** [@bioball](https://github.com/bioball)
**Base:** `main` ← **Head:** `fix-line-comment-formatting`
---
### 📝 Commits (2)
- [`73a4371`](https://github.com/apple/pkl/commit/73a437162a0d9b8288a98025bac48318a4594f08) Fix formatting of argument lists
- [`da04db0`](https://github.com/apple/pkl/commit/da04db0297188c652c1a345e3b52e43c57be3ffb) Revert getBaseSeparator logic
### 📊 Changes
**6 files changed** (+82 additions, -33 deletions)
<details>
<summary>View changed files</summary>
📝 `pkl-formatter/src/main/kotlin/org/pkl/formatter/Builder.kt` (+21 -20)
📝 `pkl-formatter/src/test/files/FormatterSnippetTests/input/method-call-trailing-lambdas.pkl` (+24 -0)
📝 `pkl-formatter/src/test/files/FormatterSnippetTests/output/line-breaks.pkl` (+4 -3)
📝 `pkl-formatter/src/test/files/FormatterSnippetTests/output/method-call-trailing-lambdas.pkl` (+29 -0)
📝 `pkl-parser/src/main/java/org/pkl/parser/GenericParser.java` (+3 -3)
📝 `pkl-parser/src/main/java/org/pkl/parser/syntax/generic/FullSpan.java` (+1 -7)
</details>
### 📄 Description
This fixes two issues:
1. Leading/trailing line comments surrounding a lambda should make that lambda not "trailing", because the formatting otherwise looks bad and also isn't stable
2. Fix incorrect algorithm for detecting trailing lambda (currently, any number of lambdas makes the alg return `true`)
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/apple/pkl/pull/1283
Author: @bioball
Created: 11/3/2025
Status: ✅ Merged
Merged: 11/3/2025
Merged by: @bioball
Base:
main← Head:fix-line-comment-formatting📝 Commits (2)
73a4371Fix formatting of argument listsda04db0Revert getBaseSeparator logic📊 Changes
6 files changed (+82 additions, -33 deletions)
View changed files
📝
pkl-formatter/src/main/kotlin/org/pkl/formatter/Builder.kt(+21 -20)📝
pkl-formatter/src/test/files/FormatterSnippetTests/input/method-call-trailing-lambdas.pkl(+24 -0)📝
pkl-formatter/src/test/files/FormatterSnippetTests/output/line-breaks.pkl(+4 -3)📝
pkl-formatter/src/test/files/FormatterSnippetTests/output/method-call-trailing-lambdas.pkl(+29 -0)📝
pkl-parser/src/main/java/org/pkl/parser/GenericParser.java(+3 -3)📝
pkl-parser/src/main/java/org/pkl/parser/syntax/generic/FullSpan.java(+1 -7)📄 Description
This fixes two issues:
true)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.