使用方法参数缩进的Netbeans自动格式问题 [英] Netbeans auto format issue with method parameter indention

查看:173
本文介绍了使用方法参数缩进的Netbeans自动格式问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试确定是否错过了(或滥用了)配置设置.

I'm trying to figure out if i missed (or misused) a configuration setting.

在这段代码上使用自动套用格式:

Using autoformat on this piece of code:

<?php
class foo {

    public function test() {
        $x = $this->foobar(
            1,
            2
        );
    }

}

产生:

<?php

class foo {

    public function test() {
        $x = $this->foobar(
                1,
                2
        );
    }

}

我希望netbeans停止这样做,因为除此之外,自动格式化的效果还不错.

and i'd like netbeans to stop doing that because apart from that the auto formatting works quite well.

只有在函数调用所在的行上有赋值时,这种情况才会发生.

It only happens if there is an assignment on the line with the function call.

推荐答案

您将获得2个连续缩进,一个用于赋值,一个用于参数列表. 如果您在作业和$this->foobar之间插入一个分隔符,则会更明显:

You are getting 2 continuation indents, one for the assignment and one for the parameter list. If you insert a break between the assignment and $this->foobar it becomes more apparent:

class foo {
    public function test() {
        $x =
            $this->foobar(
                1,
                2
        );
    }
}

所以,这就是它的原因".不幸的是,NB公开了很少用于格式化php的控件.似乎没有办法改变这种行为.

So, that's the "why" of it. Unfortunately, NB exposes very few controls for formatting php. There does not appear to be a way to change this behavior.

我建议打开错误报告,并密切注意 Netbeans PHP博客

这篇关于使用方法参数缩进的Netbeans自动格式问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆