# intellij

Sam Pengilly

10/18/2023, 5:16 AM
Does IntelliJ have a code formatting option for the continuation indent to apply when splitting a delegated property onto a new line? For example:
Copy code
// This example of a typically formatted long property initialiser
val someProperty: SomeType =

// Example of how this should look with property delegation if it followed the same pattern
// This is what detekt/ktlint expect with their formatting rules for continuation indent
val someDelegatedProperty: SomeType by

// This is what IntelliJ does when you run an auto-format on the file
val someDelegatedProperty: SomeType by

// Doesn't matter if you put the "by" on the upper line or the lower line, IntelliJ auto-format removes the continuation indent

// Another option when the initialiser is a function might be
val someDelegatedProperty: SomeType by someDelegateFunc(

// But this doesn't look great when you want to follow up with a "private set"
val someDelegatedProperty: SomeType by someDelegateFunc(
    private set

// Plus it still forces a potentially long line by keeping the function name up on the starting line

Anton Mefodichev

11/13/2023, 1:35 PM
There are related tickets: KTIJ-13548 KTIJ-13398