eclipse-jdt / eclipse-jdt/eclipse.jdt.core
[formatting] Add line wrapping setting for placing each right brace/parenthesis on a single line
- Dominant language
- Java
- Stars
- 237
- Forks
- 195
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 49
Description
It should be possible to place each right brace and parenthesis on a single line if the max line width is exceeded. For example:
`public class Parentheses extends ClassLoader {
/**
* @param list
*
* @return sorted list
*/
public List sort(List list) {
Collections.sort(
list,
new Comparator() {
@Override
public int compare(final String e1, final String e2) {
return e1.compareTo(e2) * -1;
}
}
);
return list;
}
}
`
Instead of:
`public class Parentheses extends ClassLoader {
/**
* @param list
*
* @return sorted list
*/
public List sort(List list) {
Collections.sort(list, new Comparator() {
@Override
public int compare(final String e1, final String e2) {
return e1.compareTo(e2) * -1;
}
}); // each of this should be placed on a single line as above!
return list;
}
}
`
This would make the assignment of the corresponding right and left brace/parenthesis pairs much easier and therefore enhance the readability of the code.
Contributor guide
Research direction
No files or tests are named. Start by locating the Java formatter's line-wrapping settings and their tests, then trace how closing braces and parentheses are emitted when the maximum line width is exceeded. Done means a setting produces the shown one-delimiter-per-line formatting without changing behavior when the width is not exceeded.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100