Skip to content

Commit

Permalink
Fixes QPP with no comma bug in formatter (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasnyberg authored Mar 11, 2025
1 parent cff1f76 commit a50bfb3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/language-support/src/formatting/formatting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,14 @@ export class TreePrintVisitor extends CypherCmdParserVisitor<void> {
this.avoidSpaceBetween();
return;
}
if (!ctx._from_ && !ctx._to) {
this.visitChildren(ctx);
this.concatenate();
this.concatenate();
this.concatenate();
this.avoidSpaceBetween();
return;
}
if (!ctx._from_) {
this.visitTerminalRaw(ctx.LCURLY(), { spacingChoice: 'EXTRA_SPACE' });
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,13 @@ RETURN m`;
verifyFormatting(query, expected);
});

test('QPP with only a number', () => {
const query = `MATCH (n)-->{4}(m)
RETURN n`;
const expected = query;
verifyFormatting(query, expected);
});

// Example 1 by Finbar
test('QPP spacing with star', () => {
const query = `
Expand Down

0 comments on commit a50bfb3

Please sign in to comment.