Bug 581615 - [formatting] Add line wrapping setting for placing each right brace/parenthesis on a single line
Summary: [formatting] Add line wrapping setting for placing each right brace/parenthes...
Status: NEW
Alias: None
Product: Incubator
Classification: Eclipse Project
Component: e4 (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: E4 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-01 10:31 EST by Mark Tu CLA
Modified: 2023-03-02 08:55 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Tu CLA 2023-03-01 10:31:34 EST
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 List<String> sort(List<String> list) {
	Collections.sort(
		list,
		new Comparator<String>() {
			@Override
			public int compare(final String e1, final String e2) {
				return e1.compareTo(e2) * -1;
			}
		}
	);
	return list;
}

Instead of:


public List<String> sort(List<String> list) {
	Collections.sort(list, new Comparator<String>() {
		@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 the readability of the code.
Comment 1 Mark Tu CLA 2023-03-02 08:45:26 EST
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 List<String> sort(List<String> list) {
	Collections.sort(
		list,
		new Comparator<String>() {
			@Override
			public int compare(final String e1, final String e2) {
				return e1.compareTo(e2) * -1;
			}
		}
	);
	return list;
}

Instead of:


public List<String> sort(List<String> list) {
	Collections.sort(list, new Comparator<String>() {
		@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.
Comment 2 Mark Tu CLA 2023-03-02 08:55:31 EST
The comment above is a slight typo correction of the description. Can be deleted.