TextRange (Editor editor, @NotNull KtIfExpression ifExpression) { KtExpression condition = ifExpression.getCondition(); assert condition != null : "Condition should exists for created if expression: " + ifExpression.getText(); // Delete condition from created if TextRange range = condition.getTextRange(); TextRange textRange = new TextRange(range.getStartOffset(), range.getStartOffset()); editor.getDocument().deleteString(range.getStartOffset(), range.getEndOffset()); return textRange; }