Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continuation Indent applied twice as a result of chained function calls #524

Open
EJ-K opened this issue Dec 12, 2024 · 2 comments
Open

Comments

@EJ-K
Copy link

EJ-K commented Dec 12, 2024

The continuation indent is (I believe incorrectly) being twice when a chained function call is present.

Some examples, formatted using the live playground:

fun aFunctionWithChoppedDownArguments() =
   arrayOf(
       "argument",
       "argument",
       "argument",
       "argument",
   )

fun aFunctionWithChoppedDownArgumentsAndChainedCall() =
   arrayOf(
           "argument",
           "argument",
           "argument",
           "argument",
       )
       .chained()

fun lambdaExample() = someFun {
   letsHaveIt(
       "argument",
       "argument",
       "argument",
       "argument",
   )
}

fun lambdaExampleWithChainedCall() =
   someFun {
           letsHaveIt(
               "argument",
               "argument",
               "argument",
               "argument",
           )
       }
       .chained()

Expected:

fun aFunctionWithChoppedDownArgumentsAndChainedCall() =
    arrayOf(
        "argument",
        "argument",
        "argument",
        "argument",
    )
    .chained()

fun lambdaExampleWithChainedCall() =
    someFun {
        letsHaveIt(
            "argument",
            "argument",
            "argument",
            "argument",
        )
    }
    .chained()
@nreid260
Copy link
Contributor

This is WAI from our perspective. We want some level of indent on the chained calls. Admittedly, the result is unbalanced, but it was preferable to no indentation.

@EJ-K
Copy link
Author

EJ-K commented Dec 16, 2024

This breaks from both the Android and Kotlinlang guidance on indentation. Since neither of these guides provides guidance on this specific case it feels overly-opinionated to enforce double indentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants