Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional Sorting Criteria #3

Open
juntalis opened this issue Jun 11, 2014 · 2 comments
Open

Additional Sorting Criteria #3

juntalis opened this issue Jun 11, 2014 · 2 comments
Assignees
Milestone

Comments

@juntalis
Copy link

Not sure if this is still an active project for you, but in any case, I thought I'd suggest the following functionality:

Adding additional handling for the Group element to allow for customizing the sorting criteria. Something to the effect of:

<?xml version="1.0" encoding="utf-8" ?>
<Groups xmlns="http://schemas.interact-sw.co.uk/OrderUsings/2014">
    <Group Priority="1" NamespacePattern="System*" OrderBy="LengthAscending" />
    <Group Priority="1" NamespacePattern="Microsoft*" OrderBy="LengthAscending" />
    <Space />
    <Group Priority="9999" Type="Import" NamespacePattern="*" OrderBy="AlphaAscending" />
    <Space />
    <Group Priority="9999" Type="Alias" NamespacePattern="*" OrderBy="AlphaAscending" AliasPattern="*" AliasOrderKey="Alias" />
</Groups>

Might just go to me having peculiar (possibly poor) taste, but I've always liked:

using System;
using System.Reflection;
using System.Collections.Generic;

As opposed to:

using System;
using System.Collections.Generic;
using System.Reflection;
@idg10
Copy link
Owner

idg10 commented Jun 15, 2014

Hi,

Yes, it’s still active, in the sense that I use this extension myself every day, and intend to continue maintaining it. (I’ve not done anything lately, so it has in a sense gone inactive, but that’s due to a lack of time, and is only temporary. I have a bugfix I want to implement soon.)

So if I’ve understood your feature request, you want me to add a new optional attribute the Group element called OrderBy. It would support AlphaAscending and LengthAscending (any others? ‘Descending’ versions of each of those would be the obvious thing, but that doesn’t seem very useful), and if the attribute is absent, AlphaAscending would be presumed.

AlphaAscending would be the current behaviour, while LengthAscending simply sorts within the group based on the length of the namespace.

Have I understood? Have I missed anything?

It doesn’t seem like it would be difficult, and I can’t see it causing any difficulties with maintenance or reliability, so if you’d find this a useful mechanism, I’m happy to add it.

Ian

From: Charles Grunwald [mailto:[email protected]]
Sent: 11 June 2014 23:01
To: idg10/order-usings
Subject: [order-usings] Additional Sorting Criteria (#3)

Not sure if this is still an active project for you, but in any case, I thought I'd suggest the following functionality:

Adding additional handling for the Group element to allow for customizing the sorting criteria. Something to the effect of:

<Group Priority="1" NamespacePattern="System*" OrderBy="LengthAscending" />

<Group Priority="1" NamespacePattern="Microsoft*" OrderBy="LengthAscending" />

<Space />

<Group Priority="9999" Type="Import" NamespacePattern="*" OrderBy="AlphaAscending" />

<Space />

<Group Priority="9999" Type="Alias" NamespacePattern="*" OrderBy="AlphaAscending" AliasPattern="*" AliasOrderKey="Alias" />

Might just go to me having peculiar (possibly poor) taste, but I've always liked:

using System;

using System.Reflection;

using System.Collections.Generic;

As opposed to:

using System;

using System.Collections.Generic;

using System.Reflection;


Reply to this email directly or view it on GitHubhttps://github.com//issues/3.

@juntalis
Copy link
Author

Yep, sounds like you've understood what I was suggesting. Qualifying the sort direction was sort of just tacked on for good measure, but I'd have to agree that it probably wouldn't have much use. The only question that came to my mind is how you'd handle length-based sorting when dealing with a Type="Alias" group that specifies an AliasOrderKey="Alias" attribute. My preferences only seem to apply to Import statements, so I was trying to evaluate what would be the most logical handling. (Do you sort based on alias length, or disregard the attribute and always sort based on line length)

@idg10 idg10 added this to the v1.2 milestone Jun 17, 2014
@idg10 idg10 self-assigned this Jun 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants