TextRange (@NotNull PsiElement element) { PsiElement first = element.getFirstChild(); if (!(element instanceof PsiFile) && first instanceof PsiComment && !first.textContains('\n')) { PsiElement next = first.getNextSibling(); if (next instanceof PsiWhiteSpace) next = next.getNextSibling(); if (next != null) { return new TextRange(next.getTextRange().getStartOffset(), element.getTextRange().getEndOffset()); } } return element.getTextRange(); }