Skip to content

printTree

Convert a rendered text tree to a string. Will ensure that the scheduler is empty before printing.

import { printTree } from "@alloy-js/core";
function printTree(tree: RenderedTextTree, options?: PrintTreeOptions): string;
tree

RenderedTextTree

optionsoptional

PrintTreeOptions

insertFinalNewLineoptionalboolean

If files should end with a final new line.

noFlushoptionalboolean

Skip flushing scheduled jobs before printing.

printWidthoptionalnumber

The number of characters the printer will wrap on. Defaults to 100 characters.

tabWidthoptionalnumber

The number of spaces to use for indentation. Defaults to 2 spaces.

useTabsoptionalboolean

Whether to use tabs instead of spaces for indentation. Defaults to false.

string