dfmt icon indicating copy to clipboard operation
dfmt copied to clipboard

named function arguments

Open khvorov45 opened this issue 2 years ago • 7 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,
    );
}

khvorov45 avatar Aug 01 '23 03:08 khvorov45

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?

danielzuncke avatar Oct 22 '23 07:10 danielzuncke

I'd like the option, sure.

khvorov45 avatar Oct 23 '23 03:10 khvorov45

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

WebFreak001 avatar Oct 23 '23 04:10 WebFreak001

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

redthing1 avatar Jan 24 '24 21:01 redthing1

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.

WebFreak001 avatar Jan 24 '24 23:01 WebFreak001

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);
}

FeepingCreature avatar Jan 31 '24 09:01 FeepingCreature

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

redthing1 avatar Feb 06 '24 07:02 redthing1