IDEA-162109 "pl" should match "println" in completion

This commit is contained in:
peter
2017-05-10 17:11:34 +02:00
parent 3f28a2196a
commit 23b589d978
2 changed files with 14 additions and 1 deletions
@@ -711,4 +711,11 @@ public class NameUtilMatchingTest extends UsefulTestCase {
assertPreference("GEN", "GetName", "GetExtendedName");
assertPreference("*GEN", "GetName", "GetExtendedName");
}
public void testPrintln() {
assertMatches("pl", "println");
assertMatches("pl", "printlnFoo");
assertDoesntMatch("pl", "printlnx");
}
}
@@ -385,7 +385,13 @@ public class NameUtil {
if (!Character.isLetter(c)) {
return false;
}
return i == 0 || !Character.isLetterOrDigit(text.charAt(i - 1));
return i == 0 || !Character.isLetterOrDigit(text.charAt(i - 1)) || isHardCodedWordStart(text, i);
}
private static boolean isHardCodedWordStart(String text, int i) {
return text.charAt(i) == 'l' &&
i < text.length() - 1 && text.charAt(i + 1) == 'n' &&
(text.length() == i + 2 || isWordStart(text, i + 2));
}
/**