One Feature I miss from Eclipse are Save Actions for autoformatting. Any way to have the same in Netbeans?
Automatically format sourcecode in Netbeans on save?
Asked Answered
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
unfortunately this only removes trailing spaces, it does not apply the code format you'd have defined for the project –
Brazilein
Waaaw, it really worked for me too, I didn't know that 7.3 made this important feature, we called for this for yeaaaars! –
Kitchenware
@Brazilein may have encountered the issue of separate global and project settings. Changes to global options will not affect a project unless the project is configured to use global options. To check a projects formatting (and toggle global/project specific options): Highlight the project in the Projects dialog and Choose: File > Project Properties (or Right click the project and choose Properties) and in the Categories section of the launched dialog, Choose Formatting. –
Seminole
This option is still at the same place (current NetBeans version: 11.2). –
Schutzstaffel
For Netbeans 8.2 running on Mac. Here are the steps.
1.Click Netbeans --> Preferences
2.Click on the "Editor" tab
3.In the Editor tab click on the "On Save" tab.
4.Click on the Reformat Combo Box and select the option "all lines"
Thats it, you are done.
© 2022 - 2024 — McMap. All rights reserved.