Netbeans: Auto Format - Prevent Space Formatting on Variable Assignment

耗尽温柔 提交于 2019-12-06 03:05:38

问题


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?


回答1:


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.




回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/7792998/netbeans-auto-format-prevent-space-formatting-on-variable-assignment

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!