eclipse-jdt / eclipse-jdt/eclipse.jdt.ui

Feature request: Add a new option for breaking long parameter lists

Open
#754 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
59
Forks
127
Avg merge
22h 47m
Merged PRs (30d)
28

Description

Currently, it is possible to achieve following easily for long parameter list to be wrapped:
```java
void foo(
int bar,
int baz) {
// Body of the method
}
```

Or with a different indentation:
```java
void foo(
int bar,
int baz) {
// Body of the method
}
```
However, AFAIK, it is not possible to configure the formatter to break lines before closing bracket in long parameter list declarations in such cases. This request proposes an option to allow breaking the line before the closing bracket *when the parameter list is wrapped*:
```
void foo(
int bar,
int baz
) {
// Body of the method
}
```

This style separates the body and the parameter list quite nicely and naturally, which is probably the reason why for instance Rust language sources are formatted in this way (by the official `rustfmt` tool). Note that this option does not have to be restricted to method parameters only. It the case of long generic parameter list it might be useful as well, especially when line length is more restricted and such cases occur more frequently.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.