dlang-community / dfmt

Dfmt is a formatter for D source code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

named function arguments

khvorov45 opened this issue · comments

Before formatting

void temp(int v1, int v2) {}

void main() {
    temp(v1: 1, v2: 2);
    temp(
        v1: 1, 
        v2: 2,
    );
}

After formatting

void temp(int v1, int v2) {
}

void main() {
    temp(v1 : 1, v2:
        2);
    temp(
v1 : 1,
v2:
        2,
    );
}

Would you like to have the option to choose between temp(v1: 1, v2: 2) and temp(v1 : 1, v2 : 2) like with --space_before_aa_colon=false or not?

I'd like the option, sure.

makes sense for consistency and formatting code is likely to be the same as AA as well

I'm still having this issue in vscode, is my dfmt too old or something? My extension is up to date.

did you enable beta/nightly branch for serve-d?

Try upgrading to serve-d nightly by setting the d.servedReleaseChannel setting in vscode (Ctrl-, for User Settings) to nightly - afterwards, reload the window with Ctrl-Shift-P -> Reload Window and let it automatically download the update.

I'm still seeing this issue with dfmt master.

Source:

void test() {
    return Struct(
        foo: field.foo,
        bar: field.bar,
        baz: field.baz);
}

dfmt --keep_line_breaks=true test.d:

void test()
{
    return Struct(
foo: field.foo,
bar: field.bar,
baz: field.baz);
}

I am seeing the same thing as well, with the master branch.