void (@NotNull InsertionContext context, @NotNull LookupElement item) { context.setAddCompletionChar(false); final Editor editor = context.getEditor(); final Document document = editor.getDocument(); final int tailOffset = context.getTailOffset(); if (document.getTextLength() < tailOffset + 2 || !document.getText(new TextRange(tailOffset, tailOffset + 2)).equals(":]")) { document.insertString(tailOffset, ":]"); } editor.getCaretModel().moveCaretRelatively(2, 0, false, false, true); }