File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -15,13 +15,18 @@ public static class StringExtensions
15
15
private static readonly string [ ] _optionPrefixStrings = { "--" , "-" , "/" } ;
16
16
17
17
internal static bool ContainsCaseInsensitive (
18
+ this string source ,
19
+ string value ) =>
20
+ source . IndexOfCaseInsensitive ( value ) >= 0 ;
21
+
22
+ internal static int IndexOfCaseInsensitive (
18
23
this string source ,
19
24
string value ) =>
20
25
CultureInfo . InvariantCulture
21
26
. CompareInfo
22
27
. IndexOf ( source ,
23
28
value ?? "" ,
24
- CompareOptions . OrdinalIgnoreCase ) >= 0 ;
29
+ CompareOptions . OrdinalIgnoreCase ) ;
25
30
26
31
internal static string RemovePrefix ( this string rawAlias )
27
32
{
Original file line number Diff line number Diff line change @@ -146,8 +146,9 @@ public virtual IEnumerable<string> GetSuggestions(string textToMatch = null)
146
146
return this . ChildSymbolAliases ( )
147
147
. Concat ( argumentSuggestions )
148
148
. Distinct ( )
149
- . OrderBy ( symbol => symbol , StringComparer . OrdinalIgnoreCase )
150
- . Containing ( textToMatch ) ;
149
+ . Containing ( textToMatch )
150
+ . OrderBy ( symbol => symbol . IndexOfCaseInsensitive ( textToMatch ) )
151
+ . ThenBy ( symbol => symbol , StringComparer . OrdinalIgnoreCase ) ;
151
152
}
152
153
153
154
public override string ToString ( ) => $ "{ GetType ( ) . Name } : { Name } ";
You can’t perform that action at this time.
0 commit comments