Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically format sourcecode in Netbeans on save?

Tags:

One Feature I miss from Eclipse are Save Actions for autoformatting. Any way to have the same in Netbeans?

like image 723
Hermine D. Avatar asked Mar 31 '10 05:03

Hermine D.


People also ask

How do I Auto format in NetBeans?

To format all the code in NetBeans, press Alt + Shift + F. If you want to indent lines, select the lines and press Alt + Shift + right arrow key, and to unindent, press Alt + Shift + left arrow key.

How do I indent multiple lines in NetBeans?

You can select multiple lines of code and then indent all those lines by pressing Tab or Ctrl-T. You can reverse indentation of lines by selecting those lines and then pressing Shift-Tab or Ctrl-D.

How do I open a Javadoc in NetBeans?

From the menu bar, select Window > IDE Tools > Javadoc Documentation to open the Javadoc window, in which the documentation is refreshed automatically for the location of your cursor.


1 Answers

Starting with NB 7.3, go to Tools -> Options -> Editor -> On Save

You can select reformat and remove trailing spaces for any language.

You will need to specify the reformat option to "all lines" if you want it to format all of your code

like image 125
jaudette Avatar answered Dec 14 '22 21:12

jaudette