When model element is edited and saved, the resulting file is sometimes rewritten with elements sorted differently. This decreases readability of git diffs.
Rules:
Namespaces on the top of the file (does not work, sometimes they are re-sorted) – they should be sorted by their names.
Elements within the file (does to work, sometimes they are re-sorted) – they should be sorted by their type (so elements from the same namespace are grouped together) and Id as that never changes
Attributes within the elements (works, they are sorted by name)
I propose an improvement here for sorting the elements. The purpose is that the files are also easier to read by humans. The elements (e.g. entity fields/actions/filters) should be ordered in the following way:
Element name (so e.g. entity fields are grouped together)
@name (so. e.g. entity fields are ordered by name first)
@id (so order would stay the same in case there would be two elements with the same name within the same group)