IMB
IMB

Reputation: 15929

Netbeans: Auto Format - Prevent Space Formatting on Variable Assignment

I prefer formatting assignments like this:

$foo          = $bar;
$long_foo     = $bar;

instead of this:

$foo = $bar;
$long_foo = $bar;

However the latter is being used by Netbeans when using auto format. Anyone knows how to fix that?

Upvotes: 6

Views: 2565

Answers (3)

lyhong
lyhong

Reputation: 947

It's been 3 years since this question has been posted but I think it is very useful, so I should answer this question. I've found one website that it seems right to your question.

In Alignment category there are new properties for Group Multiline Alignment - Assignment and Array Initializer.

Formatting Options

Upvotes: 5

Andy Dingfelder
Andy Dingfelder

Reputation: 2150

I think the short answer is: you can't. There are a few things you can configure as listed onhttp://netbeans.org/kb/docs/java/editor-codereference.html but for the most part there is not a lot of configuration.

Have you looked at 3rd party plugins? I used one for eclipse called Jalopy http://jalopy.sourceforge.net/ that I read somewhere might be supported for netbeans... Worth investigation

Upvotes: 0

user1050755
user1050755

Reputation: 11691

Generally, I'd like to know how to prevent Netbeans (and maybe other editors) from reformatting specific parts of my code... for example, Netbeans does a pretty bad job at formatting chained method calls with nesting. It totally ignores the nesting level when calculating the indentation width.

Upvotes: 1

Related Questions