TextRange (GroovyPsiElement element) { assert element instanceof GrMethodCallExpression; GrMethodCallExpression withCall = (GrMethodCallExpression) element; GrCondition condition = withCall.getExpressionArguments()[0]; int endOffset = condition.getTextRange().getStartOffset(); condition.getParent().getNode().removeChild(condition.getNode()); return new TextRange(endOffset, endOffset); }