private ILookupItem SetRelevanceSortPriority(ILookupItem item, UnityEventFunction function) { // When items are sorted by relevance, highest value wins. It can be tricky to know if the item is going to // be positioned correctly, but essentially, the more flags you have, the higher up in the list you'll be. // Language specific flags have the most boost power, so the type of declared element helps a lot (methods // are higher than types, but not as high as local variables). Environmental flags will still boost the // relevance, but not by as much. So text matching will boost above other items of the same declared element // type, but won't boost a method name over a local variable name. The evaluation mode can also give a small // but significant boost - Light has higher relevance than Full. Many of these flags are set automatically // by looking at the declared element type, or evaluation mode, etc. But we can set some values explicitly, // which can give a meaningful boost and get our items to the top of the list // Secondary sort order is OrderString, which is usually display text, but can be overridden. // Generated items get a boost over normal declared element items item.Placement.Relevance |= (long)CLRLookupItemRelevance.GenerateItems; // Set high selection priority to push us further up, unless it's undocumented, in which case, give it a // smaller selection boost item = !function.Undocumented ? item.WithHighSelectionPriority() : item.WithLowSelectionPriority(); return(item); }