void (@NotNull InsertionContext context, @NotNull AbstractLookup item) { final Object object = item.getObject(); LOG.debug("object = " + object); handleInsertImpl(context, item, context.getCompletionChar()); final Editor editor = context.getEditor(); final CharSequence charsSequence = editor.getDocument().getCharsSequence(); final CaretModel caretModel = editor.getCaretModel(); int offset = caretModel.getOffset(); if (item instanceof FunctionLookup) { if (charAt(charsSequence, offset) != '(') { EditorModificationUtil.insertStringAtCaret(editor, "()"); if (((FunctionLookup)item).hasParameters()) { caretModel.moveCaretRelatively(-1, 0, false, false, true); } } else { caretModel.moveCaretRelatively(1, 0, false, false, true); } } else if (item instanceof NamespaceLookup) { if (charAt(charsSequence, offset) != ':') { EditorModificationUtil.insertStringAtCaret(editor, ":"); return; } } if (context.getCompletionChar() == '\t') { if (charAt(charsSequence, offset) == ',') { offset++; caretModel.moveCaretRelatively(1, 0, false, false, true); while (charAt(charsSequence, offset++) == ' ') { caretModel.moveCaretRelatively(1, 0, false, false, true); } } else if (isIdentifier(charAt(charsSequence, offset)) && isIdentifier(charAt(charsSequence, offset - 1))) { EditorModificationUtil.insertStringAtCaret(editor, " "); } else if (charAt(charsSequence, offset) == ':') { caretModel.moveCaretRelatively(1, 0, false, false, true); } } }