TextRange () { int endOffset = getTextRange().getEndOffset(); PsiElement last = getLastChild(); while (isSpace(last)) { endOffset -= last.getTextLength(); last = last.getPrevSibling(); } int startOffset = getTextOffset(); PsiElement first = getFirstChild(); while (startOffset < endOffset && isSpace(first)) { startOffset += first.getTextLength(); first = first.getNextSibling(); } return new TextRange(startOffset, endOffset); }