import { CodeBlockWriter } from "https://dotland.deno.dev/x/ts_morph@18.0.0/ts_morph.js";
Code writer that assists with formatting and visualizing blocks of JavaScript or TypeScript code.
Methods
Writes a blank line if the condition is true.
Conditionally writes text.
Conditionally writes a line of text.
Conditionally writes a line of text.
Writes the text within the provided action with hanging indentation.
Writes the text within the provided action with hanging indentation unless writing a block.
Gets if the writer is currently at the start of the first line of the text, block, or indentation block.
Gets if the writer is currently on the first line of the text, block, or indentation block.
Iterates over the writer character char codes in reverse order. The iteration stops when a non-null or undefined value is returned from the action. The returned value is then returned by the method.
Iterates over the writer characters in reverse order. The iteration stops when a non-null or undefined value is returned from the action. The returned value is then returned by the method.
Queues the indentation level for the next lines written.
Queues the indentation level for the next lines written using the provided indentation text.
Sets the current indentation using the provided indentation text.
Inserts text at the provided position.
This method is "unsafe" because it won't update the state of the writer unless inserting at the end position. It is biased towards being fast at inserting closer to the start or end, but slower to insert in the middle. Only use this if absolutely necessary.
Sets the indentation level within the provided action and restores the writer's indentation state afterwards.
Sets the indentation level with the provided indentation text within the provided action and restores the writer's indentation state afterwards.