Skip to content

Commit

Permalink
Allow for keywords after ":" property access operator in Snowflake
Browse files Browse the repository at this point in the history
Fixes #706
  • Loading branch information
nene committed Jan 26, 2024
1 parent afd2f5e commit 821186a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/languages/snowflake/snowflake.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,10 @@ export const snowflake: DialectOptions = {
'::',
// String concat
'||',
// Get Path
':',
// Generators: https://docs.snowflake.com/en/sql-reference/functions/generator.html#generator
'=>',
],
propertyAccessOperators: [':'],
},
formatOptions: {
alwaysDenseOperators: [':', '::'],
Expand Down
6 changes: 6 additions & 0 deletions test/snowflake.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ describe('SnowflakeFormatter', () => {
foo:bar.baz
`);
});
it(`formats ':' path-operator when followed by reserved keyword`, () => {
expect(format(`SELECT foo : from`)).toBe(dedent`
SELECT
foo:from
`);
});
});

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

0 comments on commit 821186a

Please sign in to comment.