kotlinintellij-ideaautoformatting

Intellij disable new line before annotated field for Kotlin


IntelliJ autoformat keeps adding a blank lines between class field declarations having annotations. Do you know how to disable it? This happens for kotlin files since does not work like that for java files.

Example, between each var intellij adds a blank line each time I execute autoformat.

class Resign : UnitTest() {
    @InjectMocks
    private lateinit var resignService: ResignServiceImpl

    @Mock
    private lateinit var actionAccess: ActionAccess

    @Mock
    private lateinit var userReportConverter: UserReportConverter

    ....
}

Solution

  • The problem was fixed in KT-37891. The option to disable this behavior should be available in the next plugin version.

    You may also consider voting for KT-32185: 'More code style options for minimum blank lines'