int (final List<? extends IElementType> tokens, final boolean atStreamEdge, final TokenTextGetter getter) { if (tokens.isEmpty()) return 0; int result = 0; for (int idx = 0; idx < tokens.size(); idx++) { final IElementType tokenType = tokens.get(idx); if (TokenSet.WHITE_SPACE.contains(tokenType)) { if (StringUtil.containsLineBreak(getter.get(idx))) break; } else if (BASIC_JAVA_PLAIN_COMMENT_BIT_SET.contains(tokenType)) { result = idx + 1; } else { break; } } return result; }