Disable indent and inc/dec time.

This commit is contained in:
Logan Smyth 2016-07-14 22:58:11 -07:00
parent 9b8b5112df
commit 44282e4579

View File

@ -21,23 +21,13 @@ export default class Printer {
_printedCommentStarts: Object;
_parenPushNewlineState: ?Object;
/**
* Get the current indent.
*/
_getIndent(): string {
if (this.format.compact || this.format.concise) {
return "";
} else {
return repeat(this.format.indent.style, this._indent);
}
}
/**
* Increment indent size.
*/
indent(): void {
if (this.format.compact || this.format.concise) return;
this._indent++;
}
@ -46,6 +36,8 @@ export default class Printer {
*/
dedent(): void {
if (this.format.compact || this.format.concise) return;
this._indent--;
}
@ -189,7 +181,7 @@ export default class Printer {
_maybeIndent(str: string): void {
// we've got a newline before us so prepend on the indentation
if (!this.format.compact && this._indent && this.endsWith("\n") && str[0] !== "\n") {
if (this._indent && this.endsWith("\n") && str[0] !== "\n") {
this._buf.queue(this._getIndent());
}
}
@ -225,6 +217,14 @@ export default class Printer {
}
}
/**
* Get the current indent.
*/
_getIndent(): string {
return repeat(this.format.indent.style, this._indent);
}
/**
* Set some state that will be modified if a newline has been inserted before any
* non-space characters.