Skip to content

Commit eb29939

Browse files
committed
Avoid too long lines
1 parent 8112b30 commit eb29939

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/core/Formatter.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,14 @@ export default class Formatter {
121121

122122
// Opening parentheses increase the block indent level and start a new line
123123
formatOpeningParentheses(token, query) {
124-
// Take out the preceding space unless there was whitespace there in the original query or another opening parens
125-
if (this.previousToken().type !== tokenTypes.WHITESPACE && this.previousToken().type !== tokenTypes.OPEN_PAREN && this.previousToken().type !== tokenTypes.LINE_COMMENT) {
124+
// Take out the preceding space unless there was whitespace there in the original query
125+
// or another opening parens or line comment
126+
const preserveWhitespaceFor = [
127+
tokenTypes.WHITESPACE,
128+
tokenTypes.OPEN_PAREN,
129+
tokenTypes.LINE_COMMENT,
130+
];
131+
if (!preserveWhitespaceFor.includes(this.previousToken().type)) {
126132
query = trimEnd(query);
127133
}
128134
query += token.value;

0 commit comments

Comments
 (0)