void (@NotNull PsiElement element) { super.visitElement(element); if (DuplocatorUtil.isIgnoredNode(element)) { return; } final CompiledPattern pattern = globalVisitor.getContext().getPattern(); final MatchingHandler handler = pattern.getHandler(element); if (!(handler instanceof SubstitutionHandler) && !(handler instanceof TopLevelMatchingHandler) && !(handler instanceof LightTopLevelMatchingHandler)) { pattern.setHandler(element, new SkippingHandler(handler)); } // todo: simplify logic /* place skipping handler under top-level handler, because when we skip top-level node we can get non top-level handler, so depth matching won't be done!; */ if (handler instanceof LightTopLevelMatchingHandler) { final MatchingHandler delegate = ((LightTopLevelMatchingHandler)handler).getDelegate(); if (!(delegate instanceof SubstitutionHandler)) { pattern.setHandler(element, new LightTopLevelMatchingHandler(new SkippingHandler(delegate))); } } }