Closed MaximSysoev closed 1 week ago
Sorry, this is not the way the rule works. Ktlint favors consistent formatting. So it will format all classes according to the same rule. When ktlint_class_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than
is set to 2
, all classes having 2 or more parameters will have their parameters wrapped on separate lines. At the same time, all classes having less than 2 parameter will be written as a single line unless the max_line_length
is exceeded.
Ok, I see. Thank you for the answer.
In 1.3.0 version class-signature rule begin force unwrapping class signature with 1 parameter if
ktlint_class_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = 2
. In 1.2.1 it didn't it. It parameters count more than 2 it should force wrap it, but it seems, that this class has single parameter, so it could be either single-line or multi-line.Expected Behavior
If I formatted this class as multi-line it should stay multi-line.
Observed Behavior
As a result of formatting ktlint make class signature with 1 param a single line.
Steps to Reproduce
Setup
ktlint_class_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = 2
Create any class with 1 parameter in the constructor. Press option+command+LYour Environment
.editorconfig
settingsktlint_class_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = 2