Kotlin / Kotlin/ktfmt

Correctly handle indent for if/when conditions with line comments before them

Open
#692 0 comments 0 reactions 1 assignee Claimed by @AbdullinAM View on GitHub
bug
Dominant language
Kotlin
Stars
1.3k
Forks
116
Avg merge
4d 10h
Merged PRs (30d)
15

Description

Currently, line comments break the indent for all expressions with conditions (i.e. everything that uses `emitKeywordWithCondition). Line breaks force a new line, however because no actual GJF `breakOp` was called, it is not aware of the break and does not add necessary indents:
```
if (//foo
x) {
bar()
}

when (//foo
x) {
1 if //foo
baz() -> TODO()
}

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.