belav / csharpier

CSharpier is an opinionated code formatter for c#.
https://csharpier.com
MIT License
1.25k stars 84 forks source link

VSCode extension support local csharpier install #1178

Open mcm-ham opened 4 months ago

mcm-ham commented 4 months ago

We're using megalinter https://megalinter.io/v6/descriptors/csharp_csharpier/ to ensure code is formatted however it requires developers to install the same version of csharpier that megalinter uses otherwise there's a mismatch. Being able to use local install would allow us to checkin the dotnet-tools.json file into source control so version is aligned without additional developer repo instructions.

Note we did try csharpier msbuild that would allow us to achieve our goal, however since it touches every file it breaks incremental build resulting in much longer rebuild times.

mcm-ham commented 4 months ago

Related #1036

belav commented 4 months ago

The vscode extension does support using a local version of csharpier. If you added the local version while vscode was open you may need to restart vscode.

For the msbuild version, all it does is run the csharpier tool. And the tool should only be modifying files that have formatting changes. I validated that with the latest version and from what I can tell in git, it has been that way since a very early version.