editing the NetBeans source formatting standard
Asked Answered
F

3

21

Is there any way of changing the standard by which NetBeans automatically formats the code when doing "Source->Format"? I seem to remember seeing this option somewhere, but I can't find anything about it.

Fraunhofer answered 26/4, 2010 at 9:21 Comment(0)
U
26

You can change a very limited number of settings related to formatting.
open up netbeans IDE
Go to tools->options
click on Editor button on top left of the options dialog box
click on the formatting tab
select PHP from the language select box
then you would be able to see the required settings that can be changed.



Latest version 7.3 will solve most of your needs.

Underground answered 26/4, 2010 at 9:59 Comment(3)
This worked perfectly for me. Worth noting is when I had "All Languages" selected I had a very limited number of Categories (1) to work with. Once I changed this to PHP there were a ton of helpful, changeable values. I'm using NetBeans 7.0Intensive
I don't have Comments listed as an option. How can I prevent Netbeans auto-formatting my comments. I like them without any indent, and it's aligning them with my functions.Pragmatist
If changing the settings in tools->options->editor->format have no affect, check the settings under file->project properties->formatting. You may have Use project specific options selectedKlusek
T
6

The formatting preferences are at two 'levels' in NetBeans 6.9 Beta and NetBeans 6.8. There is a global setting, which is available via the Options item of the Tools menu (Preferences item of the NetBeans menu on Mac OS X). This opens a Options dialog. Select the Formatting tab of the Editor 'category', and then change the language to PHP.

alt text http://www.freeimagehosting.net/uploads/587cd38396.png

You can also specify formatting on a per-project basis. To do that, select your PHP project in the Project explorer and the select the Project Properties item from the File menu. When the Properties dialog opens, select the Formatting category from the navigation list on the left side of the dialog.

alt text http://www.freeimagehosting.net/uploads/47904df6e4.png

Note: In 6.8, there are only two formatting categories that you can change: Tabs and Indents; Braces. It looks like the "preview" area is not rendered correctly. NetBeans 6.9 Beta extends the number of formatting categories (Tabs and Indents, Alignment, Braces, Blank Lines, Spaces, Wrapping). The issues with the preview area appear to be resolved, too.

Temporize answered 26/4, 2010 at 16:36 Comment(0)
S
2

This might help.

Tools->Options->Editor->Formatting

Seavey answered 26/4, 2010 at 9:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.