belav / csharpier

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

Support custom file extensions with IDE extensions #1274

Open belav opened 3 months ago

belav commented 3 months ago

1251 is adding support for custom file extensions.

Right now all the IDE extensions are hardcoded to only try to format cs files.

Should we send all file edits to csharpier?

Should we make a configuration option for what file types to send to csharpier?

NotAsea commented 3 months ago

highly upvote, i missed Csharpier when i work at .cshtml, and .razor file. dotnet format just suck ass, resharper-cli is too bloat and heavy and if you dont have rider license it's no go. Also you can only implement for razor file as f# already has their own well-working formatter

belav commented 3 months ago

To be clear, this issue will not be adding support for formatting razor files. This is just to support non-standard file extensions that someone wants formatted with the c# formatter.

belav commented 2 weeks ago

I believe for vscode it will just need to have a given extension associated with csharp, something like this. I just need to test then document it.

// settings.json
{
  "files.associations": {
    "*.csx": "csharp"
  }
}

When CSharpier supports formatting xml, then the vscode extension will have to register itself as an xml formatting provider.