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

Wrap annotated parameters in function to new line (ktlint_official only) #1908

Closed
paul-dingemans opened this issue Apr 2, 2023 · 2 comments · Fixed by #1910
Closed

Wrap annotated parameters in function to new line (ktlint_official only) #1908

paul-dingemans opened this issue Apr 2, 2023 · 2 comments · Fixed by #1910

Comments

@paul-dingemans
Copy link
Collaborator

Arguments and parameters in functions should be wrapped to a newline in the ktlint_official code style. In line with #642 the annotations may still be placed on the same line as the annotated construct.

fun foo(a: int, @Bar1 b: int, @Bar1 @Bar2 c: int, @Bar3("bar3") @Bar1 d: int) {}

should be formatted as:

fun foo(
    a: int,
    @Bar1 b: int,
    @Bar1 @Bar2 c: int,
    @Bar3("bar3") @Bar1 d: int
) {}
@paul-dingemans paul-dingemans added this to the 0.49.0 milestone Apr 2, 2023
paul-dingemans added a commit that referenced this issue Apr 2, 2023
…ktlint_official` only

Closes #1908

Wrap annotated projection types in type argument lists to a separate line `annotation`

Closes #1909
paul-dingemans added a commit that referenced this issue Apr 2, 2023
Wrap annotated function parameters to a separate line in code style `ktlint_official` only

Closes #1908

Wrap annotated projection types in type argument lists to a separate line `annotation`

Closes #1909
@cdavie-artium
Copy link

Is there a way to have these rules apply only when the line exceeds max_line_length? It does not seem to currently.

@paul-dingemans
Copy link
Collaborator Author

Is there a way to have these rules apply only when the line exceeds max_line_length? It does not seem to currently.

See new issue #1977

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants