-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
Adding csproj formatting #858
base: main
Are you sure you want to change the base?
Conversation
The first pass at this was to just use the https://github.com/belav/csharpier-repos/pull/63/files?diff=split&w=1 Maybe instead for a first pass this can
I think that should be pretty easy to do using the existing Then the two remaining things I think are also needed
# this would be the default value
filesToFormat:
- cs
- csproj
- props
- targets Do you have any thoughts @shocklateboy92 ? |
Actually, maybe more like what prettier does. Which can be combined with options for files, and at some point also allow custom formatters tabWidth: 4
overrides:
- files: "*.csproj"
options:
tabWidth: 2
- files: ["*.props", "*.targets"]
formatter: none
- files: "*.ps1"
formatter: PluginThatFormatsPowershell |
75f4d75
to
a8d1c64
Compare
😃 Hi there, I am using both csharpier and prettier in my projects and wondering if this would be some duplicate effort. I have been using prettier for everything besides .cs files (like JSON files), and for .csproj (XML) files there is @prettier/plugin-xml. The plugin uses linguist-languages to identify XML file types base on extensions, and it already includes file types like .csproj, .props and .targets. The list of extensions for XML can be found here. So far the experience is pretty good. There may also be tooling concerns (VSCode settings) for including csproj formatting in csharpier. For instance, users may need to set csharpier as the default XML formatter, but is it a good idea? Anyway, csharpier is a nice tool, and thanks for the effort to keep improving it. |
My initial pass for this was just intended to clean up whitespace and indentation, but I already ran into reasons why I think it needs to do a bit more than that and can probably use their code as a starting point. Thanks for sharing the link! Even if prettier already supports this type of formatting I still see value in csharpier providing the functionality. There are situations where someone may not want to deal with node/npm and still be able to format xml. For a web app, they probably already have node but there are plenty of other types projects out there. |
# Conflicts: # Directory.Build.props # Scripts/UpdateCSharpierRepos.ps1 # Src/CSharpier.Cli/CommandLineFormatter.cs # Src/CSharpier.Generators/CSharpier.Generators.csproj # Src/CSharpier.Playground/ClientApp/src/AppContext.ts # Src/CSharpier.Playground/ClientApp/src/Controls.tsx # Src/CSharpier.Playground/ClientApp/src/FormatCode.ts # Src/CSharpier.Playground/Controllers/FormatController.cs # Src/CSharpier.Tests.Generators/CSharpier.Tests.Generators.csproj # Src/CSharpier.Tests.Generators/FormattingTestsGenerator.cs # Src/CSharpier.Tests/CodeFormatterTests.cs # Src/CSharpier.Tests/FormattingTests/BaseTest.cs # Src/CSharpier.Tests/Samples/AllInOne.test # Src/CSharpier/CSharpFormatter.cs # Src/CSharpier/CodeFormatter.cs
# Conflicts: # Src/CSharpier/SyntaxPrinter/FormattingContext.cs # Src/CSharpier/SyntaxPrinter/TrailingComma.cs
# Conflicts: # Src/CSharpier.Cli/CommandLineFormatter.cs # Src/CSharpier.Playground/Controllers/FormatController.cs # Src/CSharpier/CSharpFormatter.cs # Src/CSharpier/SyntaxPrinter/FormattingContext.cs # Src/CSharpier/SyntaxPrinter/Token.cs
closes #819