Skip to content

Support for custom field ordering for sort document #302

@foxydevloper

Description

@foxydevloper

You should be able to customize the order of fields when using "Sort Document".
Ideally it should use the order of fields from the JSON schema used by the document. (edit: this probably isn't possible since properties are a dictionary)
This would be very useful when you have large documents with many entries, and you want the order of the fields in the document to be consistent but not strictly sorted alphabetically.
In my case, I have a large array with many entries, and I want the objects' fields to start with "id", then "name", then "description", which is the order they're defined in the JSON schema. However, when using sort document, the order becomes "description", "id", "name", and some other less important fields end up above "id".

Furthermore, a feature that allows you to sort an array by specific fields, such as ordering an objects in an array by their "category" and "date" fields would be great. (edit: it could just use the custom field order). This could probably be seperate from "Sort document", and only apply to the array you're hovering over, something like "Sort array by fields"

There can be a configuration in settings.json which let you define the order of fields, like

fieldOrder = ["category", "id", "name", "description"] // Order fields to have category, id, name, description first

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions