sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Dotnet format should take a single file

Open IanGraingerGMSL opened this issue 1 year ago • 1 comments

Description of the problem

Dotnet format is fantastic. We use it to check all the .editorconfig rules have been followed in our builds.

But really I want a version of prettier that I have for Typescript. So that I can run dotnet format on the open file every time I press 'Save', and so I could run it on just modified files as a pre-commit hook (rather than having to run it on the whole solution).

Describe the solution I'd like

dotnet format [filename|filename list|file glob pattern].

IanGraingerGMSL avatar Aug 28 '24 13:08 IanGraingerGMSL

Similar to https://github.com/dotnet/sdk/issues/42713

IanGraingerGMSL avatar Aug 28 '24 13:08 IanGraingerGMSL

Somebody mentioned the --include flag - I don't think this is good enough, it still requires you to specify a project/solution. I'm naive to the reason for this, but I assume it's to help with import solution or something like that. If that's the case, that doesn't seem like a great reason. prettier for example can operator on a single tsx/jsx without knowledge of the rest of the project as far as I'm aware, and I think it would be a great feature to have with dotnet format, too

Mattwmaster58 avatar Jul 16 '25 15:07 Mattwmaster58

Somebody mentioned the --include flag - I don't think this is good enough, it still requires you to specify a project/solution. I'm naive to the reason for this, but I assume it's to help with import solution or something like that. If that's the case, that doesn't seem like a great reason. prettier for example can operator on a single tsx/jsx without knowledge of the rest of the project as far as I'm aware, and I think it would be a great feature to have with dotnet format, too

I tried the --include, it scan all the solution then do your file for example on a project I have it take 2 minutes with one file include cause it scan all the files

x0rld avatar Nov 24 '25 13:11 x0rld