@@ -166,7 +166,7 @@ private static int getScoreOfFilterMatchHelper(int prefixLength, String document
166166 return i + prefixLength ;
167167 }
168168
169- int matchLength = lengthOfPrefixMatch (documentFilter , completionFilter .substring (i ));
169+ int matchLength = commonPrefixLength (documentFilter , completionFilter .substring (i ));
170170 if (matchLength == documentFilterLength ) {
171171 return i + prefixLength ;
172172 }
@@ -176,7 +176,7 @@ private static int getScoreOfFilterMatchHelper(int prefixLength, String document
176176
177177 i = completionFilter .indexOf (searchChar , i + 1 );
178178 while (i != -1 ) {
179- matchLength = lengthOfPrefixMatch (documentFilter , completionFilter .substring (i ));
179+ matchLength = commonPrefixLength (documentFilter , completionFilter .substring (i ));
180180 if (matchLength == documentFilterLength ) {
181181 return i + prefixLength ;
182182 }
@@ -192,10 +192,10 @@ private static int getScoreOfFilterMatchHelper(int prefixLength, String document
192192 return prefixLength + bestScore ;
193193 }
194194
195- private static int lengthOfPrefixMatch ( String first , String second ) {
195+ private static int commonPrefixLength ( final String first , final String second ) {
196196 int i ;
197- final var maxLength = Math .min (first .length (), second .length ());
198- for (i = 0 ; i < maxLength ; i ++) {
197+ final var maxCommonLength = Math .min (first .length (), second .length ());
198+ for (i = 0 ; i < maxCommonLength ; i ++) {
199199 if (first .charAt (i ) != second .charAt (i ))
200200 break ;
201201 }
0 commit comments