@@ -11,25 +11,28 @@ public static List<string> FindAll([NotNull] List<string> items, [NotNull] strin
1111 {
1212 var length = search . Length ;
1313 if ( length == 0 ) return items ;
14- var result = items . FindAll ( it =>
15- {
16- var score = PluginCore . Controls . CompletionList . SmartMatch ( it , search , length ) ;
17- return score > 0 && score < 6 ;
18- } ) ;
14+ var result = items . FindAll ( it => IsMatch ( it , search , length ) ) ;
1915 return result ;
2016 }
2117
2218 [ NotNull ]
23- public static List < MemberModel > FindAll ( [ NotNull ] List < MemberModel > items , [ NotNull ] string search )
19+ public static List < MemberModel > FindAll ( [ NotNull ] List < MemberModel > items , [ NotNull ] string search ) => FindAll ( items , search , false ) ;
20+
21+ [ NotNull ]
22+ public static List < MemberModel > FindAll ( [ NotNull ] List < MemberModel > items , [ NotNull ] string search , bool isHaxe )
2423 {
2524 var length = search . Length ;
2625 if ( length == 0 ) return items ;
27- var result = items . FindAll ( it =>
28- {
29- var score = PluginCore . Controls . CompletionList . SmartMatch ( it . FullName , search , length ) ;
30- return score > 0 && score < 6 ;
31- } ) ;
26+ var result = items . FindAll ( it => IsMatch ( it . FullName , search , length )
27+ || ( ( it . Flags & FlagType . Constructor ) != 0
28+ && ( IsMatch ( "constructor" , search , length ) || ( isHaxe && IsMatch ( "new" , search , length ) ) ) ) ) ;
3229 return result ;
3330 }
31+
32+ static bool IsMatch ( string word , string search , int length )
33+ {
34+ var score = PluginCore . Controls . CompletionList . SmartMatch ( word , search , length ) ;
35+ return score > 0 && score < 6 ;
36+ }
3437 }
3538}
0 commit comments