5

当然,像 NetBeans 一样强大的 IDE 并不是毫无头绪,但是当我只是输入代码时,它是这样格式化的:

$(document).ready(function() {
    if (someVar > 2)
        {
            complain('that is not how you indent braces');
        }
        else if (someVar == -1)
            complain('this is not right either!');
        else
            {
                complain('but it did auto outdent the else which is smart');
                complain('smart indeed');
            }
});

我该如何解决这个问题,使其格式如下:

$(document).ready(function() {
    if (someVar > 2)
    {
        // this is how it's done
    }
    else if (someVar == -1)
        // this is right
    else
    {
        // correct
    }
});
4

1 回答 1

3

代码格式化在 NetBeans 的早期版本中不是可用的功能,但随着 NetBeans 7 的发布(我相信)被添加到程序中。尝试转到工具 -> 选项 -> 编辑器 -> 格式并查看可用的选项,因为如果可以的话,您可以在其中添加代码格式。

如果这不能解决问题,我建议您执行以下操作(无特定顺序)。

  • 检查他们的文档/支持页面: http: //netbeans.org/kb/index.html
  • 在他们的论坛上发布问题。
  • 通过电子邮件发送他们的技术支持。
  • 在他们的网站上提交支持票。
  • 在https://superuser.com/上询问好人(他们非常擅长修改软件为他们工作,而不是反对他们。
于 2011-08-14T02:09:41.977 回答