void (@NotNull ProgressIndicator progress) { SyntaxTraverser<PsiElement> s = SyntaxTraverser.psiTraverser(myFile) .filter(o -> { IElementType type = PsiUtilCore.getElementType(o); return type instanceof ILazyParseableElementType && !(type instanceof IFileElementType); }); List<PsiElement> lazyOutside = new ArrayList<>(100); List<PsiElement> lazyInside = new ArrayList<>(100); for (PsiElement e : s) { (e.getTextRange().intersects(myPriorityRange) ? lazyInside : lazyOutside).add(e); } HighlightInfoHolder holderInside = new HighlightInfoHolder(myFile, List.of()); HighlightInfoHolder holderOutside = new HighlightInfoHolder(myFile, List.of()); for (PsiElement e : lazyInside) { collectHighlights(e, holderInside, holderOutside, myPriorityRange); } List<HighlightInfo> inside = new ArrayList<>(100); List<HighlightInfo> outside = new ArrayList<>(100); for (int i=0; i<holderInside.size();i++) { inside.add(holderInside.get(i)); } myHighlightInfoProcessor.highlightsInsideVisiblePartAreProduced(myHighlightingSession, getEditor(), inside, myPriorityRange, myRestrictRange, getId()); for (PsiElement e : lazyOutside) { collectHighlights(e, holderInside, holderOutside, myPriorityRange); } for (int i=0; i<holderOutside.size();i++) { outside.add(holderOutside.get(i)); } myHighlightInfoProcessor.highlightsOutsideVisiblePartAreProduced(myHighlightingSession, getEditor(), outside, myPriorityRange, myRestrictRange, getId()); myHighlights.addAll(inside); myHighlights.addAll(outside); }