Annotation location on properties
- Dominant language
- Kotlin
- Stars
- 1.3k
- Forks
- 116
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 15
Description
Let me start with I don't know if this is a bug or intentional behavior, but I would like to understand the reasoning behind this behavior.
Assume input:
```kotlin
@get:Rule
val benchmarkRule = BenchmarkRule()
```
this turns into when using `--kotlinlang-style`:
```kotlin
@get:Rule val benchmarkRule = BenchmarkRule()
```
What is the reasoning behind annotations being on the same line?
I see similar behavior on data classes
```
@Entity
data class EntityWithEnum(
@PrimaryKey
val id: Long,
val fruit: Fruit
)
```
becomes
```
@Entity data class EntityWithEnum(@PrimaryKey val id: Long, val fruit: Fruit)
```
and it seems that putting the annotation on the same line makes it harder to read.
Contributor guide
Research direction
Reproduce both examples with --kotlinlang-style, then trace the formatter rules responsible for annotations on properties and data-class parameters. The issue names no source files or tests, so first locate the relevant formatting entry point and determine whether the behavior should be documented or changed. Done means the annotation-layout decision is explicit and the two examples produce the intended readable output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100