void (final @NotNull FileViewProvider key, final @NotNull Set<? super PostprocessFormattingTask> rangesToProcess) { final Document document = key.getDocument(); if (document == null) { return; } for (final FileASTNode fileElement : ((AbstractFileViewProvider)key).getKnownTreeRoots()) { ((TreeElement) fileElement).acceptTree(new RecursiveTreeElementWalkingVisitor() { @Override protected void visitNode(TreeElement element) { if (CodeEditUtil.isMarkedToReformatBefore(element)) { CodeEditUtil.markToReformatBefore(element, false); rangesToProcess.add(new ReformatWithHeadingWhitespaceTask( document.createRangeMarker(element.getStartOffset(), element.getStartOffset())) ); } else if (CodeEditUtil.isMarkedToReformat(element)) { CodeEditUtil.markToReformat(element, false); rangesToProcess.add(new ReformatWithHeadingWhitespaceTask( document.createRangeMarker(element.getStartOffset(), element.getStartOffset() + element.getTextLength())) ); } super.visitNode(element); } }); } }