mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SSR: no duplicate results when searching for symbols
This commit is contained in:
+2
-3
@@ -13,9 +13,8 @@ public class SymbolHandler extends MatchingHandler {
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean match(PsiElement patternNode, PsiElement matchedNode, MatchContext context) {
|
||||
// there is no need to do filtering since this is delegate of Substituion handler
|
||||
|
||||
return handler.handle(matchedNode,context);
|
||||
return handler.canMatch(patternNode, matchedNode) && handler.handle(matchedNode, context);
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -1398,6 +1398,15 @@ public class StructuralSearchTest extends StructuralSearchTestCase {
|
||||
|
||||
final String pattern2 = "'_:[write && regex( i )]";
|
||||
assertEquals("Find writes of symbol", 3, findMatchesCount(in, pattern2));
|
||||
|
||||
final String source = "class A {" +
|
||||
" static A a() {};" +
|
||||
" void m() {" +
|
||||
" A a = A.a();" +
|
||||
" }" +
|
||||
"}";
|
||||
final String pattern3 = "A";
|
||||
assertEquals("No duplicate results", 4, findMatchesCount(source, pattern3));
|
||||
}
|
||||
|
||||
public void testSearchGenerics() {
|
||||
|
||||
Reference in New Issue
Block a user