setIndentationLevel(indentationLevel: number) - Sets the current indentation level.
setIndentationLevel(whitespaceText: string) - Sets the current indentation level based on the provided whitespace text.
withIndentationLevel(indentationLevel: number, action: () => void) - Sets the indentation level within the provided action.
withIndentationLevel(whitespaceText: string, action: () => void) - Sets the indentation level based on the provided whitespace text within the action.
getIndentationLevel() - Gets the current indentation level.
queueIndentationLevel(indentationLevel: number) - Queues an indentation level to be used once a new line is written.
queueIndentationLevel(whitespaceText: string) - Queues an indentation level to be used once a new line is written based on the provided whitespace text.
hangingIndent(action: () => void) - Writes the code within the action with hanging indentation.
hangingIndentUnlessBlock(action: () => void) - Writes the code within the action with hanging indentation unless a block is written going from the first line to the second.
closeComment() - Writes text to exit a comment if in a comment.
unsafeInsert(pos: number, text: string) - Inserts text into the writer. This will not update the writer's state. Read more in its jsdoc.
isInComment() - Gets if the writer is currently in a comment.
isAtStartOfFirstLineOfBlock() - Gets if the writer is currently at the start of the first line of the text, block, or indentation block.
isOnFirstLineOfBlock() - Gets if the writer is currently on the first line of the text, block, or indentation block.
isInString() - Gets if the writer is currently in a string.
isLastNewLine() - Gets if the writer last wrote a newline.
isLastBlankLine() - Gets if the writer last wrote a blank line.
isLastSpace() - Gets if the writer last wrote a space.
isLastTab() - Gets if the writer last wrote a tab.
getLastChar() - Gets the last character written.
endsWith(text: string) - Gets if the writer ends with the provided text.
iterateLastChars<T>(action: (char: string, index: number) => T | undefined): T | undefined - Iterates over the writer's characters in reverse order, stopping once a non-null or undefined value is returned and returns that value.
iterateLastCharCodes<T>(action: (charCode: number, index: number) => T | undefined): T | undefined - A slightly faster version of iterateLastChars that doesn't allocate a string per character.