csharpier icon indicating copy to clipboard operation
csharpier copied to clipboard

CSharpier deletes arguments of primary constructor on struct

Open superdweebie opened this issue 1 year ago • 6 comments

public struct Test(string arg1)
{
    public string Arg1 { get; } = arg1;
}

becomes:

public struct Test
{
    public string Arg1 { get; } = arg1;
}

superdweebie avatar Dec 11 '23 06:12 superdweebie

I've had to turn CSharpier off after migrating to .Net 8 due to this issue.

superdweebie avatar Dec 11 '23 06:12 superdweebie

Sorry about missing that primary constructor case, I can hopefully get a fix out today after work.

belav avatar Dec 12 '23 16:12 belav

Thanks for sharing your work with the world. No stress from me.

superdweebie avatar Dec 12 '23 19:12 superdweebie

It looks like this did make it into 0.26.0, are you perhaps on an older version?

See https://github.com/belav/csharpier/issues/969

belav avatar Dec 13 '23 03:12 belav

I installed via Visual Studio Extensions. It says I have version 1.4.8. It also says there are no updates available. Should I install via command line instead?

superdweebie avatar Dec 14 '23 05:12 superdweebie

The extension is versioned separately from CSharpier itself. People working on multiple projects with teams may have each project on a different version of csharpier.

You probably are using the version of CSharpier that was available when you installed the extension. Figuring out a way to show that info to the user and/or a way to update CSharpier from the extension has been on my list for a while but I haven't had time to get to it.

Assuming you have it installed globally you can run dotnet tool update -g csharpier Then restart the IDE, it caches some information about what version of csharpier to use for files in directories.

belav avatar Dec 14 '23 16:12 belav