Closed aivanovski closed 1 month ago
Your example code does have a block body instead of an expression body. So the .editorconfig
property ktlint_function_signature_body_expression_wrapping
has no effect on that example.
When using code style android_studio
, the function signature can contain any number of parameters in a single line as long as the entire signature fits on the single line. If you always want to wrap signature containing multiple parameters, you will need to set property ktlint_function_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than
to 2
. See https://pinterest.github.io/ktlint/latest/rules/standard/#function-signature
In case it still does not work as expected, please post your .editorconfig
. Also make sure to explicitly save .editorconfig
after changing it, and before running ktlint again.
It works, thank you!
Expected Behavior
Function declaration should be multiline. The changing of existing parameters in
.editorconfig
doesn't lead to expected result. The debug output of ktlint is here ktlint-output.txtObserved Behavior
Function declaration is single line
Steps to Reproduce
1 - install ktlint 2 - create
.editorconfig
file with output of command:ktlint generateEditorConfig --code-style android_studio
3 - changektlint_function_signature_body_expression_wrapping
tomultiline
4 - format the codektlint --editorconfig=".editorconfig" --format --log-level=debug
Your Environment
ktlint v1.2.1