void (@NotNull InsertionContext context, @NotNull LookupElement item) { Editor editor = context.getEditor(); Document document = editor.getDocument(); Project project = context.getProject(); if (item instanceof LookupElementDecorator) { ((LookupElementDecorator<?>)item).getDelegate().handleInsert(context); } PsiDocumentManager.getInstance(project).commitDocument(document); int lineOffset = document.getLineStartOffset(document.getLineNumber(editor.getCaretModel().getOffset())); CodeStyleManager.getInstance(project).adjustLineIndent(document, lineOffset); }