void (InsertionContext context, LookupElement item) { final boolean isNamespace = (item.getObject() instanceof NamespaceLookup); final CharSequence charsSequence = context.getEditor().getDocument().getCharsSequence(); final int textLength = context.getEditor().getDocument().getTextLength(); int x = context.getSelectionEndOffset(); while (x < textLength) { final char c = charAt(charsSequence, x); if (isIdentifier(c) || c == '*' || (c == ':' && !isNamespace)) { x++; } else { break; } } context.getOffsetMap().addOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET, x); }