Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for support of custom file extensions to scan/fix #1220

Closed
NovaVoidHowl opened this issue Apr 7, 2024 · 1 comment · Fixed by #1251
Closed

Request for support of custom file extensions to scan/fix #1220

NovaVoidHowl opened this issue Apr 7, 2024 · 1 comment · Fixed by #1251
Milestone

Comments

@NovaVoidHowl
Copy link

Request

As it currently stands, it is not possible to scan C# files that have custom extensions (for build/deployment processes etc.)
The only work around for this, is to have a special script/process: that changes the extension, runs CSharpier, then puts the extension back.

Concept

Add a config section to the '.csharpierrc.*' that allows the user to pick the file extensions to target ie.

printWidth: 120
useTabs: false
tabWidth: 2
fileExtensions:
  - .cs
  - .cs.custom
@belav belav added this to the 0.29.0 milestone Apr 18, 2024
@belav
Copy link
Owner

belav commented Apr 18, 2024

I have a PR with partly implemented csproj formatting and had the same idea because it made sense to allow someone to use that formatter for xml, props, etc. I'll work on getting the ability to specify formatters for other extensions it into the next release.

One possibility

formatters:
  - type: csharp
    extensions: [ ".cs", ".cs.custom" ]
  - type: xml
    extensions: [ ".xml", ".csproj" ]

Or maybe support it with .editorconfig.

[*.{cs,cs.custom}]
csharpier_formatter = csharp

[*.xml]
csharpier_formatter = xml

I should also take a look at how prettier does this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants