List<IElementType> (EditorHighlighter highlighter) { List<IElementType> tokens = new ArrayList<>(); HighlighterIterator iterator = highlighter.createIterator(0); while (!iterator.atEnd()) { tokens.add(iterator.getTokenType()); iterator.advance(); } return tokens; }