mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SpellChecker:fix IdentifierSplitter (support numbers in names IDEA-53401)
This commit is contained in:
@@ -47,15 +47,6 @@ public abstract class BaseSplitter implements Splitter {
|
||||
}
|
||||
|
||||
|
||||
protected static boolean isAllWordsAreUpperCased(String[] words) {
|
||||
if (words == null) return false;
|
||||
for (String word : words) {
|
||||
if (!Strings.isUpperCase(word)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected static boolean isAllWordsAreUpperCased(@NotNull String text, @NotNull List<TextRange> words) {
|
||||
for (TextRange word : words) {
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ public class IdentifierSplitter extends BaseSplitter {
|
||||
private static final Pattern WORD = Pattern.compile("\\b\\p{L}*'?\\p{L}*");
|
||||
|
||||
@NonNls
|
||||
private static final Pattern WORD_EXT = Pattern.compile("(\\p{L}*?)[-_$\\[\\]]");
|
||||
private static final Pattern WORD_EXT = Pattern.compile("(\\p{L}*?)[-_$\\[\\]0-9]");
|
||||
|
||||
@NonNls
|
||||
private static final Pattern WORD_IN_QUOTES = Pattern.compile("'([^']*)'");
|
||||
|
||||
@@ -120,6 +120,17 @@ public class SplitterTest extends TestCase {
|
||||
correctListToCheck(checkAreas, text, new String[]{});
|
||||
}
|
||||
|
||||
public void testIdentifiersWithNumbers() {
|
||||
String text = "result1";
|
||||
List<CheckArea> checkAreas = SplitterFactory.getInstance().getIdentifierSplitter().split(text);
|
||||
correctListToCheck(checkAreas, text, new String[]{"result"});
|
||||
}
|
||||
|
||||
public void testIdentifiersWithNumbersInside() {
|
||||
String text = "result1result";
|
||||
List<CheckArea> checkAreas = SplitterFactory.getInstance().getIdentifierSplitter().split(text);
|
||||
correctListToCheck(checkAreas, text, new String[]{"result","result"});
|
||||
}
|
||||
|
||||
public void testWordWithApostrophe2() {
|
||||
String text = "customers'";
|
||||
|
||||
Reference in New Issue
Block a user