TextRange (@NotNull Project project, @NotNull Editor editor, @NotNull PsiElement container, PsiElement @NotNull[] statements) { TextRange textRange = super.surroundStatements(project, editor, container, statements); if (textRange == null) { return null; } // Delete dummy "b" element for caret editor.getDocument().deleteString(textRange.getStartOffset(), textRange.getEndOffset()); return new TextRange(textRange.getStartOffset(), textRange.getStartOffset()); }