From 13596344465038683c7b2ecc34f4cefb36ec9c37 Mon Sep 17 00:00:00 2001 From: Rene Saarsoo Date: Sat, 21 Dec 2024 12:11:23 +0200 Subject: [PATCH] Treat $ACTION as keyword in Transact-SQL Fixes #810 --- src/languages/transactsql/transactsql.keywords.ts | 2 ++ test/transactsql.test.ts | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/languages/transactsql/transactsql.keywords.ts b/src/languages/transactsql/transactsql.keywords.ts index 9bedf6cc0e..f24d7967d9 100644 --- a/src/languages/transactsql/transactsql.keywords.ts +++ b/src/languages/transactsql/transactsql.keywords.ts @@ -289,6 +289,8 @@ export const keywords: string[] = [ 'WRITE', 'YEAR', 'ZONE', + // https://learn.microsoft.com/en-us/sql/t-sql/queries/output-clause-transact-sql?view=sql-server-ver16#action + '$ACTION', ]; export const dataTypes: string[] = [ diff --git a/test/transactsql.test.ts b/test/transactsql.test.ts index 0fe818a84f..e63a4a4193 100644 --- a/test/transactsql.test.ts +++ b/test/transactsql.test.ts @@ -197,4 +197,12 @@ describe('TransactSqlFormatter', () => { CREATE TABLE foo (name char(65)); `); }); + + // Issue #810 + it('supports special $ACTION keyword', () => { + expect(format(`MERGE INTO tbl OUTPUT $action AS act;`)).toBe(dedent` + MERGE INTO + tbl OUTPUT $action AS act; + `); + }); });