diff --git a/src/lexer/disambiguateTokens.ts b/src/lexer/disambiguateTokens.ts index 41af6c7135..939fb3ffc5 100644 --- a/src/lexer/disambiguateTokens.ts +++ b/src/lexer/disambiguateTokens.ts @@ -31,6 +31,10 @@ const propertyNameKeywordToIdent = (token: Token, i: number, tokens: Token[]): T if (prevToken && prevToken.type === TokenType.PROPERTY_ACCESS_OPERATOR) { return { ...token, type: TokenType.IDENTIFIER, text: token.raw }; } + const nextToken = nextNonCommentToken(tokens, i); + if (nextToken && nextToken.type === TokenType.PROPERTY_ACCESS_OPERATOR) { + return { ...token, type: TokenType.IDENTIFIER, text: token.raw }; + } } return token; }; diff --git a/test/options/keywordCase.ts b/test/options/keywordCase.ts index 15bc72e619..37e6f6a4cc 100644 --- a/test/options/keywordCase.ts +++ b/test/options/keywordCase.ts @@ -62,6 +62,18 @@ export default function supportsKeywordCase(format: FormatFn) { `); }); + it('treats dot-seperated keywords as plain identifiers', () => { + const result = format('select table.and from set.select', { + keywordCase: 'upper', + }); + expect(result).toBe(dedent` + SELECT + table.and + FROM + set.select + `); + }); + // regression test for #356 it('formats multi-word reserved clauses into single line', () => { const result = format(