void (InsertionContext context, LookupElement item, char c) { // final int selectionLength = (context.getSelectionEndOffset() - context.getStartOffset()); // context.shiftOffsets(item.getLookupString().length() - data.prefix.length() - selectionLength); adjustIdentifierEnd(context, item); final int idEndOffset = context.getOffsetMap().getOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET); final boolean isOverwrite = c == Lookup.REPLACE_SELECT_CHAR; if (idEndOffset != context.getSelectionEndOffset() && isOverwrite) { context.getEditor().getDocument().deleteString(context.getSelectionEndOffset(), idEndOffset); } }