Skip to content

Commit 821186a

Browse files
committed
Allow for keywords after ":" property access operator in Snowflake
Fixes #706
1 parent afd2f5e commit 821186a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/languages/snowflake/snowflake.formatter.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,10 @@ export const snowflake: DialectOptions = {
326326
'::',
327327
// String concat
328328
'||',
329-
// Get Path
330-
':',
331329
// Generators: https://docs.snowflake.com/en/sql-reference/functions/generator.html#generator
332330
'=>',
333331
],
332+
propertyAccessOperators: [':'],
334333
},
335334
formatOptions: {
336335
alwaysDenseOperators: [':', '::'],

test/snowflake.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ describe('SnowflakeFormatter', () => {
8080
foo:bar.baz
8181
`);
8282
});
83+
it(`formats ':' path-operator when followed by reserved keyword`, () => {
84+
expect(format(`SELECT foo : from`)).toBe(dedent`
85+
SELECT
86+
foo:from
87+
`);
88+
});
8389
});
8490

8591
it('formats type-cast operator without spaces', () => {

0 commit comments

Comments
 (0)