Ejemplo n.º 1
0
        public static ImmutableArray <CodeAction> SortActionsByMostRecentlyUsed(ImmutableArray <CodeAction> codeActions)
        {
            // make a local so this array can't change out from under us.
            var mruTitles = s_mruTitles;

            return(codeActions.Sort((d1, d2) => ComparerWithState.CompareTo(d1, d2, (mruTitles, codeActions), s_comparers)));
        }
        public int CompareTo(PackageWithAssemblyResult? other)
        {
            if (other is null)
                return 1;

            return ComparerWithState.CompareTo(this, other, s_comparers);
        }
Ejemplo n.º 3
0
            public int CompareTo(Document document, Reference other)
            {
                var diff = ComparerWithState.CompareTo(this, other, document, s_comparers);

                if (diff != 0)
                {
                    return(diff);
                }

                // Both our names need to change.  Sort by the name we're
                // changing to.
                diff = StringComparer.OrdinalIgnoreCase.Compare(
                    SearchResult.DesiredName,
                    other.SearchResult.DesiredName
                    );
                if (diff != 0)
                {
                    return(diff);
                }

                // If the weights are the same and no names changed, just order
                // them based on the namespace we're adding an import for.
                return(INamespaceOrTypeSymbolExtensions.CompareNameParts(
                           SearchResult.NameParts,
                           other.SearchResult.NameParts,
                           placeSystemNamespaceFirst: true
                           ));
            }
            public int Compare(SyntaxToken x, SyntaxToken y)
            {
                if (x.Kind() == y.Kind())
                {
                    return(0);
                }

                return(ComparerWithState.CompareTo(x, y, s_comparers));
            }
Ejemplo n.º 5
0
        public int CompareTo(VirtualTreePoint other)
        {
            if (Text != other.Text)
            {
                throw new InvalidOperationException(EditorFeaturesResources.Can_t_compare_positions_from_different_text_snapshots);
            }

            return(ComparerWithState.CompareTo(this, other, s_comparers));
        }
Ejemplo n.º 6
0
 public int CompareTo(PatternMatch other, bool ignoreCase)
 => ComparerWithState.CompareTo(this, other, ignoreCase, s_comparers);
Ejemplo n.º 7
0
 public int CompareTo(MatchResult other, string filterText)
 => ComparerWithState.CompareTo(this, other, filterText, s_comparers);
 // For ordering of NavigateToItems, see
 // http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.language.navigateto.interfaces.navigatetoitem.aspx
 protected static int CompareNavigateToItems(NavigateToItem a, NavigateToItem b)
 => ComparerWithState.CompareTo(a, b, s_comparisonComponents);
Ejemplo n.º 9
0
 public int CompareTo(FilterResult other)
 => ComparerWithState.CompareTo(this, other, s_comparers);
Ejemplo n.º 10
0
 public int CompareTo(PackageWithAssemblyResult other)
 => ComparerWithState.CompareTo(this, other, s_comparers);
Ejemplo n.º 11
0
 // This comparison is used in the deletion/backspace scenario for selecting best elements.
 public int CompareTo(MatchResult <TEditorCompletionItem> other, string filterText)
 => ComparerWithState.CompareTo(this, other, filterText, s_comparers);