boolean (@NotNull Editor editor, int offset) { if (offset < 0) return false; HighlighterIterator iterator = editor.getHighlighter().createIterator(offset); int parenCount = 0; while (!iterator.atEnd()) { IElementType tokenType = iterator.getTokenType(); if (tokenType == JavaTokenType.AT) { return true; } if (tokenType == JavaTokenType.RPARENTH || tokenType == JavaTokenType.LBRACE || tokenType == JavaTokenType.EQ || tokenType == JavaTokenType.SEMICOLON || tokenType == JavaTokenType.COMMA) { return false; } if (tokenType == JavaTokenType.LPARENTH && ++parenCount > 1) { return false; } iterator.retreat(); } return false; }