Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to customize Eclipse's text editor code formatting

Tags:

How can I set my Eclipse's code formatter to allow code rows longer than 80 characters. I know that very long lines is hard to read but in my opinion 80 characters per line is very small value for wide screen monitors.

like image 823
Eugeniu Torica Avatar asked Nov 24 '09 13:11

Eugeniu Torica


People also ask

How do you change the code style in VS code?

You can format an entire file with Format Document (Ctrl+Shift+I) or just the current selection with Format Selection (Ctrl+K Ctrl+F) in right-click context menu. You can also configure auto-formatting with the following settings: editor. formatOnSave - to format when you save your file.

How can I get beautify code in Eclipse?

Go to Source | Format Document or press Ctrl+Shift+F.

How can I beautify code in IntelliJ?

Go to Settings/Preferences | Editor | Code Style, select your programming language, and open the Wrapping and Braces tab. In the Keep when reformatting section, select the formatting rules which you want to ignore and deselect those which should be applied. Reformat your code ( Ctrl+Alt+L ).


1 Answers

In Preferences, go to Java > Code Style > Formatter and edit/create the formatter and go to tab Line Wrapping. There in you can set the Maximum line width.

Further on you can in General > Editors > Text Editors also set the Print margin column which should shift up that margin (a 1px wide vertical line in the right side of your code) to the desired position. This however doesn't affect the formatter, only the human eye.

like image 147
BalusC Avatar answered Sep 28 '22 02:09

BalusC