How to sort functions with no special attributes first?

I am trying to get my methods sorted in a particular way and can't seem to figure out how to do so.

I would like to have them be first grouped by accessibility, and then by abstract/virtual/override with the first ones being the functions that have no special attribute. It would look like this:

public void OrindaryFunc() { }//Nothing special, so it goes first.
public abstract void AbstractFunc();//Then abstract functions.
public virtual void VirtualFunc() { }//Then virtual functions.
public virtual override void OverridenFunc() { }//Finally overriden functions.


No matter what I try, I get this instead:

public abstract void AbstractFunc();
public virtual void VirtualFunc() { }
public virtual override void OverridenFunc() { }


public void OrindaryFunc() { }//This always ends up last, when I want it to be first.

The problem is that you can only tell it to sort by something (abstract/virtual/override). There is no way to tell it to put the functions with no special attributes on top. It would be the equivalent of saying sort by <Nothing/>, if there were such a thing.

Can anyone suggest a way to do this? Any help is much appreciated.


 
    <Entry>
      <Match>
        <And>
          <Kind Is="method"/>
 
          <Access Is="public"/>
          <Not>
            <Static/>
          </Not>
          <Not>
            <HandlesEvent />
          </Not>
          <Not>
            <Kind Is="destructor"/>
          </Not>
        </And>
      </Match>
      <Sort>
        <Abstract/>
        <Virtual/>
        <Override/>
        <Name/>
      </Sort>
      <Group Region="Instance Methods"/>
    </Entry>

0
10 comments
Avatar
Permanently deleted user

Bump?

0

I see 2 possible solutions:

1) Create separate match entry for methods without attributes, and with. For example:

 
    <Entry>
      <Match>
        <And>
          <Kind Is="method"/>
 
          <Access Is="public"/>
        </And>
      </Match>
    </Entry>


 
    <Entry>
      <Match>
        <And>
          <Kind Is="method"/>
 
          <Access Is="public"/>
          <Abstract/>
        </And>       </Match>     </Entry>


 
    <Entry>
      <Match>
        <And>
          <Kind Is="method"/>
 
          <Access Is="public"/>
          <Virtual/>
        </And>       </Match>     </Entry>


.......


2) Create single entry, but sort them by attributes in descending order (so, method without attribute goes first)


 
    <Entry>
      <Match>
        <And>
          <Kind Is="method"/>
 
          <Access Is="public"/>
          </And>
      </Match>       <Sort Descending="true">         <Abstract/>         <Virtual/>         <Override/>       </Sort>       <Group Region=
"Instance Methods"/>     </Entry>

0
Avatar
Permanently deleted user

Thanks for the help.


I really would like to use #2, however when I try it, this line:


<Sort Descending="true">


Gives me the error:


The 'Descending' attribute is not declared.


Is there another way to specify the sort order?


Thanks.

0

Oops, I was wrong, sorry.

Use the following:

<Sort>
  <Abstract Descending="true"/>
</Sort>

Or

<Sort>
  <Abstract Ascending="false"/>
</Sort>

both variants are the same

0
Avatar
Permanently deleted user

Neither of those has any effect. Regardless of which I use, I get this:

public abstract void pubabs1(); 
public virtual void pubvirt1() { }
public virtual void pubvirt2() { }
public void fu() { }


When what I want is this:

public void fu() { }//<--No special attribute, so it goes at the top.
public abstract void pubabs1();
public virtual void pubvirt1() { }
public virtual void pubvirt2() { }


I am going to try for method one since it seems the only way possible at this point. If I do that, is there any way to enclose multiple matches in a single region since I will have to arrange each type of function with a separate match?

Thanks.
0

For now, there are no multiple matches in a single gerion :(

0

For now, there are no multiple matches in a single gerion :(

0
Avatar
Permanently deleted user

Ok, well it looks like this functionality is not supported at the time.

May I suggest it as a feature request for a future update? I imagine it would be something along the lines of a <None/> element where you are specifying that a function has no special attributes.

Thanks for the help.

0
Avatar
Permanently deleted user

Thanks! I look forward to it in a future release.

0

Please sign in to leave a comment.