Skip to content

[Feature]: Sort X(A)ML attributes (alphabetically) #1906

Description

@ririshi

Description

Currently, the output of CSharpier's formatting is different for different input permutations of semantically-equivalent XML files, e.g. attributes are left in their original order.

I used to use https://github.com/Xavalon/XamlStyler, but recently switched to only using CSharpier, because the Rider IDE plugins seem to fight each other when enabling format on save. CSharpier does a decent job formatting XML, but I'm missing the automatic attribute sorting from XamlStyler.

I'd like CSharpier to deterministically sort XML attributes. It doesn't need to be strictly alphabetical per se, I think that could be detrimental to readability. Perhaps grouping the sorting by namespace prefixes makes sense?

I'm expecting this to be a source of debate because obviously people's tastes differ, but I hope we can reach a consensus on the "right" sorting strategy and get it implemented.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions