Kotlin / Kotlin/ktfmt

>1 annotation is kept on same line, contrary to style guide

Open
#226 13 comments 28 reactions 0 assignees View on GitHub
enhancement formatting-discussions
Dominant language
Kotlin
Stars
1.3k
Forks
116
Avg merge
4d 10h
Merged PRs (30d)
15

Description

Original code:
```kotlin
@Inject @Foo
var bar: Bar
```

ktfmt removes line break:
```kotlin
@Inject @Foo var bar: Bar
```

Android Kotlin style guide says annotations can only be on the same line as the declaration if there is only annotation (and without arguments): https://developer.android.com/kotlin/style-guide#annotations

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the two Kotlin snippets with ktfmt and compare the output with the Android Kotlin style guide's annotation rules. Trace the formatter's annotation and declaration line-breaking behavior; done means multiple annotations remain separate from the declaration while the single-annotation case continues to follow the formatter's conventions.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.