Open lor1mp opened 1 year ago
Tagging subscribers to this area: @dotnet/area-system-xml See info in area-owners.md if you want to be subscribed.
Author: | lor1mp |
---|---|
Assignees: | - |
Labels: | `api-suggestion`, `area-System.Xml` |
Milestone: | - |
cc @krwq
Also -- I have the changes in a branch for this method. However, I'm open to whatever path forward, I can make the changes.
Background and motivation
Recently we discovered that
.editorconfig
files aren't respected for.xml
and.csproj
files in Visual Studio anddotnet format
. It looks like this is a Rider feature. However, across our team the formatting of the project files becomes an issue because the default Visual Studio formatting is different from the.editorconfig
that Rider is able to format to. So, in lieu of available tooling, I looked to build a tool. However, the .NET XML library doesn't support the options for theXmlTextWriter
, and there doesn't seem to be a viable alternative to writing XML files.The options I'm proposing to support are:
Basically, there's not an easy way to configure the
XmlTextWriter
to output with the spacing required for the options in our.editorconfig
. So, I am proposing to add these options.API Proposal
API Usage
Alternative Designs
These options could also be moved to
XmlWriterSettings
, and supported in other writers. However, this is the minimal change required to support formatting XML with spacing options in the basicXmlTextWriter
.Risks
It is a public API change, but it's only additive. Would need to ensure default values keep format unchanged.