vs-code-typescript-class-organizer
vs-code-typescript-class-organizer copied to clipboard
Feature request: Setting for disabling/enabling automatic sorting by name
The organizing of member groups is absolutely great, until you notice that the fields/properties defined in interfaces/types get automatically sorted in ascending fashion, by name.
For example:
// This is the way I'd wish for the following interface to remain written
interface Example {
id: string;
name: string;
description: string;
creds: string[];
}
// This is the result from the extension, after saving the file:
interface Example {
creds: string[];
description: string;
id: string;
name: string;
}
It would be very very helpful to have control over this feature --the automatic sorting of fields/properties pretty much obligated me to disable the extension.
Thank you for your time!
Just to add that when you have one field that depends on another, TypeScript requires that they be in the right order - sorting them by name can cause a syntax error:
class Example {
public readonly activeContacts = this.contacts.filter(...); // Error Property 'contacts' is used before its initialization.
public readonly contacts = [];
}