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

Not breaking at highest syntactic level #220

Open
bethcutler opened this issue Apr 29, 2021 · 2 comments
Open

Not breaking at highest syntactic level #220

bethcutler opened this issue Apr 29, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@bethcutler
Copy link
Contributor

Original code:

val result = sequence(Person("alice", 25), Person("bob", 20), Person("charlie", 30))
  .ktMap("MapExtractName") { it.name }

Expected result after ktfmt:

val result = 
  sequence(Person("alice", 25), Person("bob", 20), Person("charlie", 30))
    .ktMap("MapExtractName") { it.name }

Actual result:

val result =
  sequence(Person("alice", 25), Person("bob", 20), Person("charlie", 30)).ktMap(
    "MapExtractName"
  ) { it.name }
@bethcutler
Copy link
Contributor Author

A similar example, possibly related:

  val foo =
    aCall(withALongParameter).anotherChainedCall(withAnotherLongParameter).andAnother().arrayHere[
        100]
      .apply {
        // something
      }

@hick209
Copy link
Contributor

hick209 commented May 3, 2024

v0.49 gets us this:

val result =
    sequence(Person("alice", 25), Person("bob", 20), Person("charlie", 30)).ktMap(
        "MapExtractName") {
          it.name
        }

val foo =
    aCall(withALongParameter)
        .anotherChainedCall(withAnotherLongParameter)
        .andAnother()
        .arrayHere[100]
        .apply {
          // something
        }

I still dislike the first one as it does not make things any clear.
I do think the second case is good though.

@hick209 hick209 added the bug Something isn't working label May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants