开发者

Hard return (carriage return) in Eclipse code style formatter

开发者 https://www.devze.com 2023-03-11 04:46 出处:网络
I\'m used to long lines, 160 chars, because I like Monospace fonts and I have a wide LCD screen. The problem is, that the Code Style formatter doesn\'t support \"hard return\" as far as I know.

I'm used to long lines, 160 chars, because I like Monospace fonts and I have a wide LCD screen.

The problem is, that the Code Style formatter doesn't support "hard return" as far as I know.

Such a long lines are not convenient for all cases, it is good for long function definitions with Generics parameters that throws a lot of exceptions, but it is not good for something like this :

boolean success = toBool(new WebDriverWait(driver, entities.size() * interval).until(allSucceedOrFail(entities.size(), By.className(uploadSuccessCN),
                By.className(uploadErrorCN))));

Does anyone have an idea how to workaround this ?开发者_StackOverflow中文版


The Java code formatter is highly configurable, but I am not sure whether what you seek is possible. In any case, if it is at all possible, it is located in "Window > Preferences > Java > Code Style > Formatter". In that window, clic the "Edit" button.

What you seek is located on the "Line Wrapping" tab. For example, to split the line you gave as an example, you can select "Function Calls" in the list on the left, then "Wrap all elements, every element on a new line" to force it to be split... You should be able to achieve something like you want with the options in there.

0

精彩评论

暂无评论...
验证码 换一张
取 消