Closed Kolyall closed 3 months ago
Sorry but this will not be implemented as it conflicts with chain-method-continuation
which aligns/wraps all .
and ?.
before call expressions. Also, there will be no option added to make this configurable (https://pinterest.github.io/ktlint/latest/faq/#can-a-new-toggle-be-added-to-optionally-enabledisable-format-code-in-a-particular-way).
@paul-dingemans it conflicts with chain-method-continuation only if chain-method-continuation = 1
.
And in this case you may notify user about this conflict
only if
chain-method-continuation = 1
.
What do you mean with this?
@paul-dingemans Cases:
If config is:
ktlint_standard_chain-method-continuation = 1
ij_kotlin_wrap_first_method_in_call_chain = false
Expected result will be: conflict
If config is:
ktlint_standard_chain-method-continuation = 2
ij_kotlin_wrap_first_method_in_call_chain = false
Expected result will be:
viewModel.getUserStatus()
.onEach {}
.launchIn(viewLifecycleOwner.lifecycleScope)
If config is:
ktlint_standard_chain-method-continuation = 3
ij_kotlin_wrap_first_method_in_call_chain = false
Expected result will be:
viewModel.getUserStatus().onEach {}
.launchIn(viewLifecycleOwner.lifecycleScope)
Why do you think that property ktlint_standard_chain-method-continuation
can have a numeric value? This property can only be set with value enabled
or disabled
. The only numeric property for this rule is ktlint_chain_method_rule_force_multiline_when_chain_operator_count_greater_or_equal_than
. See https://pinterest.github.io/ktlint/latest/rules/experimental/#chain-method-continuation.
Versioin: 1.2.1
Rules:
Result:
Expected result: