prettier-sql
Version:
Format whitespace in a SQL query to make it more readable
43 lines (42 loc) • 1.23 kB
TypeScript
/**
* Manages indentation levels.
*
* There are two types of indentation levels:
*
* - BLOCK_LEVEL : increased by open-parenthesis
* - TOP_LEVEL : increased by RESERVED_COMMAND words
*/
export default class Indentation {
indent: string;
indentTypes: string[];
/**
* @param {string} indent Indent value, default is " " (2 spaces)
*/
constructor(indent?: string);
/**
* Returns current indentation string.
* @return {string} indentation string based on indentTypes
*/
getIndent(): string;
/**
* Increases indentation by one top-level indent.
*/
increaseTopLevel(): void;
/**
* Increases indentation by one block-level indent.
*/
increaseBlockLevel(): void;
/**
* Decreases indentation by one top-level indent.
* Does nothing when the previous indent is not top-level.
*/
decreaseTopLevel(): void;
/**
* Decreases indentation by one block-level indent.
* If there are top-level indents within the block-level indent,
* throws away these as well.
*/
decreaseBlockLevel(): void;
/** Clears all indentation */
resetIndentation(): void;
}