Friday, April 7, 2017

Eclipse string literal line wrapping

Leave a Comment

When I run the Formatter it indents string literal lines all the way to the last line of the variable name, even if that exceeds the column guide, as shown in this screenshot:

Undesired line-wrapping behavior

Ideally, I want all of the lines to be wrapped similar to the way the first line is wrapped, with just a couple of tabs (or 1 tab if possible). I've changed all the Formatter settings for assignment and binary expression and it doesn't affect the Formatter's line wrapping behavior.

Is there a way to make Eclipse wrap lines like NetBeans or maybe with some plugin?

Here's what my Formatter settings are for Line Wrapping: enter image description here

1 Answers

Answers 1

If you're looking to install a plugin that has a better wrapping function for Eclipse, you can always try Eclipse Colorer because it has an "Enhanced and fixed word wrapping mode"

If you're looking to customize the way that Eclipse wraps lines, here's how and where you do it: Preferences->Java->Code Style->Formatter, then click the Edit button and select the Comments tab. After that, the same place, you can select the Line Wrapping tab and the Indentation tab. You can also set margins and tab sizes in Preferences>General>Editors>Text Editors by editing the Displayed Tab Width

EDIT : Because previous mentions didn't have the desire effect, I'll note that Eclipse should be Eclipse Project Neon (4.6) M4 or higher. Eclipse 4.6 came with some updated word wrapping out of the box. If you're still not satisfied you can try another plugin, and in my opinion, a better plugin, which might do the trick: Eclipse Word-Wrap

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment