mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
more truthful middle word start matching criterion
This commit is contained in:
@@ -441,6 +441,7 @@ public class NameUtilTest extends UsefulTestCase {
|
||||
assertPreference("*ap", "add_profile", "application", NameUtil.MatchingCaseSensitivity.NONE);
|
||||
assertPreference("*les", "configureByFiles", "getLookupElementStrings", NameUtil.MatchingCaseSensitivity.FIRST_LETTER);
|
||||
assertPreference("*les", "configureByFiles", "getLookupElementStrings", NameUtil.MatchingCaseSensitivity.NONE);
|
||||
assertPreference("*ea", "LEADING", "NORTH_EAST", NameUtil.MatchingCaseSensitivity.NONE);
|
||||
}
|
||||
|
||||
public void testPreferEarlyMatching() {
|
||||
|
||||
@@ -92,9 +92,9 @@ public class MinusculeMatcher implements Matcher {
|
||||
|
||||
int startIndex = first.getStartOffset();
|
||||
boolean prefixMatching = isStartMatch(name, startIndex);
|
||||
boolean middleWordStart = !prefixMatching && NameUtil.isWordStart(name, first.getStartOffset());
|
||||
boolean middleWordStart = !prefixMatching && startIndex > 0 && NameUtil.isWordStart(name, startIndex) && !NameUtil.isWordStart(name, startIndex - 1);
|
||||
|
||||
return -fragmentCount + matchingCase * 20 + commonStart * 30 - startIndex + (prefixMatching ? 2 : middleWordStart ? 1 : 0) * 100 - integral;
|
||||
return -fragmentCount + matchingCase * 20 + commonStart * 30 - startIndex + (prefixMatching ? 2 : middleWordStart ? 1 : 0) * 1000 - integral;
|
||||
}
|
||||
|
||||
public boolean isStartMatch(String name) {
|
||||
|
||||
Reference in New Issue
Block a user