Netbeans:自动格式 - 防止变量赋值时出现空格格式

发布于 2024-12-10 20:35:27 字数 210 浏览 1 评论 0原文

我更喜欢这样的格式分配:

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

而不是这样:

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

但是 Netbeans 在使用自动格式时使用后者。 有人知道如何解决这个问题吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

柠檬 2024-12-17 20:35:27

这个问题已经发布三年了,但我认为它非常有用,所以我应该回答这个问题。我发现一个网站似乎是正确的你的问题。

在“对齐”类别中,有“组多行对齐”的新属性 - 赋值和数组初始值设定项。

格式选项

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

浅听莫相离 2024-12-17 20:35:27

一般来说,我想知道如何防止 Netbeans(也许还有其他编辑器)重新格式化我的代码的特定部分...例如,Netbeans 在使用嵌套格式化链式方法调用方面做得非常糟糕。在计算缩进宽度时,它完全忽略嵌套级别。

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.

月下凄凉 2024-12-17 20:35:27

我认为简短的答案是:你不能。您可以配置一些内容,如 http://netbeans.org/kb/docs/java/editor-codereference.html 上列出的,但大多数情况下没有太多配置。

您看过第 3 方插件吗?
我在 Eclipse 中使用了一个名为 Jalopy http://jalopy.sourceforge.net/ 的插件,我在某处读到它可能会受到支持对于netbeans...值得研究

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文