GenericLookupItemPlacement vs LookupItemPlacement

15 views
Skip to first unread message

Dmitry Dolotovskikh

unread,
Apr 15, 2015, 2:33:45 PM4/15/15
to resharpe...@googlegroups.com
Hi

In the v.9.0 I used GenericLookupItemPlacement class with two parameters order string and rank:

new GenericLookupItemPlacement(ProjectName + " " + Title, Rank));

It seems in the v.9.1 I need to use LookupItemPlacement class :

new LookupItemPlacement(ProjectName + " " + Title, Rank));

But visually in 9.1 the order has been changed and I don't know how to manage it.

Take a look on the picture. Right column is a ProjectName, left - Title. Order string = ProjectName + " " + Title.

I need to lift red bordered items up. To do this I pass rank=0 but unfortunatelly it does not affect.

What is the right way to get custom order?

Thanks.


Matt Ellis

unread,
Apr 15, 2015, 6:34:24 PM4/15/15
to resharpe...@googlegroups.com
9.1 introduced a new sort method - you can sort alphabetically (pretty much the old method) or you can sort by relevance. This is available in the options, and (I think) the default is to sort by relevance.

When you sort alphabetically, it uses the Location, Rank and OrderString properties of the LookupItemPlacement class. It first sorts by Location (Top, Bottom or Generic) and then sorts by Rank, and finally by OrderString. You probably only need to set OrderString. You can force things to the top or bottom by changing the Location, and use Rank to make Top and Bottom relative to other items.

When sorting by relevance, items are sorted by Relevance, and then OrderString. Again, setting OrderString is the most important, but Relevance should be set, too. All items have a relevance set from flags in the LookupItemRelevance enum. The lower 16 bits and top 16 bits are for language independent relevance flags (exact match, prefix match, from double completion, etc) and the 32 bits in the middle are for language dependent relevance (e.g. CLRLookupItemReference - enum members, local variable, types and namespaces, etc. or CssLookupItemRelevance, HtmlLookupItemRelevance, etc.). The default relevance flags are set automatically for you, but you'll need to set any language specific values. Once you've set relevance, this sorts "groups" of items higher or lower in the list, or you can include them in an existing "group" and use the OrderString to sort - and of course, OrderString can be different to the display string.

I've just updated the sorting of items for the angularjs plugin to work with this. Here's the PR: https://github.com/JetBrains/resharper-angularjs/commit/6a3bb9ed7ee1885361825b0dc47ef0e838866a4c

Regards
Matt
Reply all
Reply to author
Forward
0 new messages