CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.
Add type-specific sorting definitions to Reorganizing > Type
In order to increase reorganizing flexibility, each member type could have an associated sorting definition in the Reorganizing > Type page.
Each member is composed of multiple parts (excluding optional keywords such as static, abstract, virtual ...)
Properties, for instance, have a access modifier, a type and a name
Nested classes, on the other hand, only have a access modifier and a name.
The sorting definition would decide the sorting order when using the "Alphabetize members of the same group" (Reorganizing > General) feature.
For example, if the sorting definition for properties is "Access, type, name", it means that properties should be sorted by their access modifier, then by their type, then by their name.
This would also implement #965.
Current behavior
Currently, the "Alphabetize members of the same group" feature only allows for sorting members by their access modifiers, then by their name.
But sorting members by type before sorting by name could increase readablity drastically.
Sample code:
Here's a bunch of properties sorted using the current "Alphabetize members of the same group" setting.
public Category Category { get; set; }
public ScriptCode Code { get; }
public Impact Impact { get; set; }
public string InvariantName => LocalizedName[InvariantCulture];
public LocalizedString LocalizedDescription { get; init; }
public LocalizedString LocalizedName { get; init; }
public string Name { get => LocalizedName[CurrentUICulture]; set => LocalizedName[CurrentUICulture] = value; }
public SafetyLevel SafetyLevel { get; set; }
public ScriptType Type { get; }
public SemVersionRange Versions { get; set; }
The same properties, sorted by access modifier, then by type, then by name. (I used the "Sort Lines" feature)
public Category Category { get; set; }
public Impact Impact { get; set; }
public LocalizedString LocalizedDescription { get; init; }
public LocalizedString LocalizedName { get; init; }
public SafetyLevel SafetyLevel { get; set; }
public ScriptCode Code { get; }
public ScriptType Type { get; }
public SemVersionRange Versions { get; set; }
public string InvariantName => LocalizedName[InvariantCulture];
public string Name { get => LocalizedName[CurrentUICulture]; set => LocalizedName[CurrentUICulture] = value; }
This looks considerably prettier in my opinion, as the properties are now grouped by type in addition to the alphabetical order.
Possible interface design
As you can see, there's a bunch of unused space on the right part of the list view.
I suggest we change the list to display 2 columns : Kind and Sort order
The Kind column would contain each member type, and the Sort order column would contain a member type-specific sort order definition.
Keep in mind though, that I am not knowledgeable in UI design in any way, those are just some ideas about how to implement this feature.
Environment
Description
Add type-specific sorting definitions to Reorganizing > Type
In order to increase reorganizing flexibility, each member type could have an associated sorting definition in the Reorganizing > Type page.
Each member is composed of multiple parts (excluding optional keywords such as
static
,abstract
,virtual
...) Properties, for instance, have a access modifier, a type and a name Nested classes, on the other hand, only have a access modifier and a name.The sorting definition would decide the sorting order when using the "Alphabetize members of the same group" (Reorganizing > General) feature.
For example, if the sorting definition for properties is "Access, type, name", it means that properties should be sorted by their access modifier, then by their type, then by their name.
This would also implement #965.
Current behavior
Currently, the "Alphabetize members of the same group" feature only allows for sorting members by their access modifiers, then by their name.
But sorting members by type before sorting by name could increase readablity drastically.
Sample code:
Here's a bunch of properties sorted using the current "Alphabetize members of the same group" setting.
The same properties, sorted by access modifier, then by type, then by name. (I used the "Sort Lines" feature)
This looks considerably prettier in my opinion, as the properties are now grouped by type in addition to the alphabetical order.
Possible interface design
As you can see, there's a bunch of unused space on the right part of the list view.
I suggest we change the list to display 2 columns : Kind and Sort order
The Kind column would contain each member type, and the Sort order column would contain a member type-specific sort order definition.
Keep in mind though, that I am not knowledgeable in UI design in any way, those are just some ideas about how to implement this feature.