Skip to content

Commit

Permalink
Wrap map to separate line
Browse files Browse the repository at this point in the history
Remove the usage of `noNewLineInOpenRange`
  • Loading branch information
atulgpt committed Aug 2, 2023
1 parent baef5ba commit 41c1721
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import com.pinterest.ktlint.rule.engine.core.api.isWhiteSpaceWithNewline
import com.pinterest.ktlint.rule.engine.core.api.lastChildLeafOrSelf
import com.pinterest.ktlint.rule.engine.core.api.leavesIncludingSelf
import com.pinterest.ktlint.rule.engine.core.api.nextCodeSibling
import com.pinterest.ktlint.rule.engine.core.api.noNewLineInOpenRange
import com.pinterest.ktlint.rule.engine.core.api.prevCodeSibling
import com.pinterest.ktlint.rule.engine.core.api.prevLeaf
import com.pinterest.ktlint.rule.engine.core.api.upsertWhitespaceBeforeMe
Expand Down Expand Up @@ -75,7 +74,7 @@ public class ChainMethodContinuation :
)
} else if (previousEndBrace.elementType == RBRACE &&
isPreviousChainElementMultiline &&
!noNewLineInOpenRange(
hasNewLineInClosedRange(
previousEndBrace,
chainOperator,
)
Expand Down Expand Up @@ -183,11 +182,13 @@ public class ChainMethodContinuation :

private fun <T> Sequence<T>.takeTill(predicate: (T) -> Boolean): Sequence<T> {
var conditionMet = false
return this.takeWhile { conditionMet.not() }.map {
if (predicate(it)) {
conditionMet = true
return this
.takeWhile { conditionMet.not() }
.map {
if (predicate(it)) {
conditionMet = true
}
it
}
it
}
}
}

0 comments on commit 41c1721

Please sign in to comment.