LookupElementBuilder (@NotNull String lookupString) { return LookupElementBuilder.create(lookupString).withInsertHandler((context, item) -> { final Document document = context.getEditor().getDocument(); document.deleteString(context.getEditor().getCaretModel().getOffset(), document.getTextLength()); }); }