Skip to content

Commit

Permalink
Fixes IS CONNECTED concatenate bug in formatter (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasnyberg authored Mar 11, 2025
1 parent 8faf81a commit 224b9d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/language-support/src/formatting/formatting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -768,8 +768,8 @@ export class TreePrintVisitor extends CypherCmdParserVisitor<void> {
) => {
this.visitIfNotNull(ctx.variable());
this.visitIfNotNull(ctx.labelExpression());
if (ctx instanceof RelationshipPatternContext) {
this.visitIfNotNull(ctx.pathLength());
if (ctx instanceof RelationshipPatternContext && ctx.pathLength()) {
this.visit(ctx.pathLength());
this.concatenate();
}
this.visitIfNotNull(ctx.properties());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,4 +617,11 @@ FOREACH (item IN items |
RETURN n`;
verifyFormatting(query, expected);
});

test('relation with IS CONNECTED should not concatenate to ISCONNECTED', () => {
const query = `MATCH (n)-[IS CONNECTED]->(m)
RETURN n, m`;
const expected = query;
verifyFormatting(query, expected);
});
});

0 comments on commit 224b9d4

Please sign in to comment.