boolean (@NotNull PsiElement element, GlobalCompilingVisitor myCompilingVisitor) { final StructuralSearchProfile profile = getProfileByPsiElement(element); if (profile == null) { return false; } profile.compile(new PsiElement[]{element}, myCompilingVisitor); final CompiledPattern pattern = myCompilingVisitor.getContext().getPattern(); MatchingHandler handler = pattern.getHandler(element); if (handler instanceof TopLevelMatchingHandler topLevelMatchingHandler) { // unwrap pattern.setHandler(element, topLevelMatchingHandler.getDelegate()); } return true; }