boolean (@NotNull PsiElement start, ProcessingContext context) { PsiElement element = getParent(start); TextRange range = start.getTextRange(); if (range == null) return false; int startOffset = range.getStartOffset(); while (element != null && element.getTextRange() != null && element.getTextRange().getStartOffset() == startOffset) { if (ancestor.accepts(element, context)) { return true; } element = getParent(element); } return false; }