diff --git a/platform/platform-tests/testSrc/com/intellij/psi/util/NameUtilMatchingTest.groovy b/platform/platform-tests/testSrc/com/intellij/psi/util/NameUtilMatchingTest.groovy index d17957dc8b3e..ccf973962b0e 100644 --- a/platform/platform-tests/testSrc/com/intellij/psi/util/NameUtilMatchingTest.groovy +++ b/platform/platform-tests/testSrc/com/intellij/psi/util/NameUtilMatchingTest.groovy @@ -430,6 +430,8 @@ public class NameUtilMatchingTest extends UsefulTestCase { assertMatches("*TEST-* ", "TEST-001"); assertMatches("*TEST-0* ", "TEST-001"); assertMatches("*v2 ", "VARCHAR2"); + assertMatches("smart8co", "SmartType18CompletionTest"); + assertMatches("smart8co", "smart18completion"); } public void testSpecialSymbols() { diff --git a/platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcher.java b/platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcher.java index f7579332bca5..fb5f7bd07e6b 100644 --- a/platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcher.java +++ b/platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcher.java @@ -117,6 +117,13 @@ public class MinusculeMatcher implements Matcher { return i == 0 || !Character.isLetterOrDigit(text.charAt(i - 1)); } + private static int nextWord(@NotNull String name, int start) { + if (start < name.length() && Character.isDigit(name.charAt(start))) { + return start + 1; //treat each digit as a separate hump + } + return NameUtil.nextWord(name, start); + } + private boolean hasWildCards() { for (int i = 0; i < myPattern.length; i++) { if (isWildcard(i)) { @@ -177,7 +184,7 @@ public class MinusculeMatcher implements Matcher { if (nextHumpStart == i) { isHumpStart = true; } - nextHumpStart = NameUtil.nextWord(name, nextHumpStart); + nextHumpStart = nextWord(name, nextHumpStart); if (first != range) { humpIndex++; } @@ -457,7 +464,7 @@ public class MinusculeMatcher implements Matcher { } int nextWordStart = startFrom; while (true) { - nextWordStart = NameUtil.nextWord(name, nextWordStart); + nextWordStart = nextWord(name, nextWordStart); if (nextWordStart >= name.length()) { return -1; }