TextRange (GroovyPsiElement element) { assert element instanceof GrForStatement; GrForClause clause = ((GrForStatement) element).getClause(); int endOffset = element.getTextRange().getEndOffset(); if (clause != null) { endOffset = clause.getTextRange().getStartOffset(); clause.getParent().getNode().removeChild(clause.getNode()); } return new TextRange(endOffset, endOffset); }