boolean (@NotNull InsertionContext context) { CharSequence text = context.getDocument().getCharsSequence(); int tail = context.getTailOffset(); if (text.length() > tail + 1 && text.charAt(tail) == ' ') { char ch = text.charAt(tail + 1); if (ch == '@' || Character.isLetter(ch)) { return false; } } return super.isApplicable(context); }