taplo
taplo copied to clipboard
Feature request: sorting arrays
Sorting arrays would be cool for cargo features to be sorted. I guess somewhere there must be a toml array where the order matters but I've not yet encountered any... Wonders how we turn it on just for cargo features (is that what the schema part is for?)
This could be a formatter feature along with reordering inline table keys.
We should be careful with arrays, and this feature should be disabled by default if added, as changing array order no longer just changes the format but also the data as well.
As for scoping the behaviour, path-specific rules could be used in .taplo.toml
(https://taplo.tamasfe.dev/configuration/#rules), so that the sorting of arrays is enabled for e.g dependencies.*.features
, I wouldn't bake this in anywhere either but leave up to the users if they want to configure it for their projects.
Some additional implementation details at https://github.com/tamasfe/taplo/issues/338#issuecomment-1289489987, posting here for the sake of completeness.
It looks like this can be closed..?
It looks like this can be closed..?
Looks like it, but the website would need to be updated to document the new feature. In particular this file should mention reorder_arrays
.