void (@NotNull InsertionContext context) { FeatureUsageTracker.getInstance().triggerFeatureUsed("editing.completion.smarttype.casting"); final Editor editor = context.getEditor(); final Document document = editor.getDocument(); if (overwrite) { document.deleteString(context.getSelectionEndOffset(), context.getOffsetMap().getOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET)); } final CommonCodeStyleSettings csSettings = CompletionStyleUtil.getCodeStyleSettings(context); final int oldTail = context.getTailOffset(); context.setTailOffset(RParenthTailType.addRParenth(editor, oldTail, csSettings.SPACE_WITHIN_CAST_PARENTHESES)); getDelegate().handleInsert(CompletionUtil.newContext(context, getDelegate(), context.getStartOffset(), oldTail)); PostprocessReformattingAspect.getInstance(context.getProject()).doPostponedFormatting(); if (csSettings.SPACE_AFTER_TYPE_CAST) { context.setTailOffset(TailType.insertChar(editor, context.getTailOffset(), ' ')); } if (parameters.getCompletionType() == CompletionType.SMART || !overwrite) { editor.getCaretModel().moveToOffset(context.getTailOffset()); } editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); }