Skip to content

Commit 77786cf

Browse files
committed
Restore original formatting of THEN
1 parent d285b2b commit 77786cf

14 files changed

+40
-46
lines changed

docs/multilineLists.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ But switches to multiple lines when CASE expression is seen:
3838
SELECT
3939
first_name,
4040
CASE sex
41-
WHEN 'F'
42-
THEN 'ms'
43-
WHEN 'M'
44-
THEN 'mr'
41+
WHEN 'F' THEN 'ms'
42+
WHEN 'M' THEN 'mr'
4543
END AS title
4644
FROM persons
4745
GROUP BY age, occupation

src/languages/bigquery.formatter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ const reservedKeywords = {
632632
// 'STRUCT',
633633
'TABLE',
634634
// 'TABLESAMPLE',
635-
// 'THEN',
635+
'THEN',
636636
'TO',
637637
'TREAT',
638638
'TRUE',
@@ -816,7 +816,7 @@ const reservedBinaryCommands = [
816816
* keywords that follow a previous Statement, must be attached to subsequent data
817817
* can be fully inline or on newline with optional indent
818818
*/
819-
const reservedDependentClauses = ['WHEN', 'THEN', 'ELSE'];
819+
const reservedDependentClauses = ['WHEN', 'ELSE'];
820820

821821
// https://cloud.google.com/bigquery/docs/reference/#standard-sql-reference
822822
export default class BigQueryFormatter extends Formatter {

src/languages/db2.formatter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ const reservedKeywords = {
530530
'SYSTIMESTAMP',
531531
'TABLE',
532532
'TABLESPACE',
533+
'THEN',
533534
'TO',
534535
'TRIGGER',
535536
'TYPE',
@@ -853,7 +854,7 @@ const reservedBinaryCommands = [
853854
* keywords that follow a previous Statement, must be attached to subsequent data
854855
* can be fully inline or on newline with optional indent
855856
*/
856-
const reservedDependentClauses = ['WHEN', 'THEN', 'ELSE', 'ELSEIF'];
857+
const reservedDependentClauses = ['WHEN', 'ELSE', 'ELSEIF'];
857858

858859
// https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_72/db2/rbafzintro.htm
859860
export default class Db2Formatter extends Formatter {

src/languages/hive.formatter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ const reservedKeywords = {
483483
'SMALLINT',
484484
'TABLE',
485485
'TABLESAMPLE',
486-
// 'THEN',
486+
'THEN',
487487
'TIMESTAMP',
488488
'TO',
489489
'TRANSFORM',
@@ -610,7 +610,7 @@ const reservedBinaryCommands = [
610610
* keywords that follow a previous 'Statement', must be attached to subsequent data
611611
* can be fully inline or on newline with optional indent
612612
*/
613-
const reservedDependentClauses = ['WHEN', 'THEN', 'ELSE'];
613+
const reservedDependentClauses = ['WHEN', 'ELSE'];
614614

615615
// https://cwiki.apache.org/confluence/display/Hive/LanguageManual
616616
export default class HiveFormatter extends Formatter {

src/languages/mariadb.formatter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,7 @@ const reservedKeywords = [
813813
'TERMINATED',
814814
'TEXT',
815815
'THAN',
816+
'THEN',
816817
'TIES',
817818
'TIME',
818819
'TIMESTAMP',
@@ -1148,7 +1149,7 @@ const reservedBinaryCommands = [
11481149
* keywords that follow a previous Statement, must be attached to subsequent data
11491150
* can be fully inline or on newline with optional indent
11501151
*/
1151-
const reservedDependentClauses = ['WHEN', 'THEN', 'ELSE', 'ELSEIF', 'ELSIF'];
1152+
const reservedDependentClauses = ['WHEN', 'ELSE', 'ELSEIF', 'ELSIF'];
11521153

11531154
// For reference: https://mariadb.com/kb/en/sql-statements-structure/
11541155
export default class MariaDbFormatter extends Formatter {

src/languages/mysql.formatter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,6 +1021,7 @@ const reservedKeywords = [
10211021
'TERMINATED',
10221022
'TEXT',
10231023
'THAN',
1024+
'THEN',
10241025
'THREAD_PRIORITY',
10251026
'TIES',
10261027
'TINYBLOB',
@@ -1312,7 +1313,7 @@ const reservedBinaryCommands = [
13121313
* keywords that follow a previous Statement, must be attached to subsequent data
13131314
* can be fully inline or on newline with optional indent
13141315
*/
1315-
const reservedDependentClauses = ['WHEN', 'THEN', 'ELSE', 'ELSEIF'];
1316+
const reservedDependentClauses = ['WHEN', 'ELSE', 'ELSEIF'];
13161317

13171318
// https://dev.mysql.com/doc/refman/8.0/en/
13181319
export default class MySqlFormatter extends Formatter {

src/languages/n1ql.formatter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ const reservedKeywords = [
385385
'STATISTICS',
386386
'STRING',
387387
'SYSTEM',
388+
'THEN',
388389
'TIES',
389390
'TO',
390391
'TRAN',
@@ -506,7 +507,7 @@ const reservedBinaryCommands = [
506507
* keywords that follow a previous Statement, must be attached to subsequent data
507508
* can be fully inline or on newline with optional indent
508509
*/
509-
const reservedDependentClauses = ['WHEN', 'THEN', 'ELSE'];
510+
const reservedDependentClauses = ['WHEN', 'ELSE'];
510511

511512
// For reference: http://docs.couchbase.com.s3-website-us-west-1.amazonaws.com/server/6.0/n1ql/n1ql-language-reference/index.html
512513
export default class N1qlFormatter extends Formatter {

src/languages/plsql.formatter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ const reservedKeywords = [
310310
'TABLE',
311311
'TDO',
312312
'THE',
313+
'THEN',
313314
'TIME',
314315
'TIMESTAMP',
315316
'TIMEZONE_ABBR',
@@ -438,7 +439,7 @@ const reservedBinaryCommands = [
438439
* keywords that follow a previous Statement, must be attached to subsequent data
439440
* can be fully inline or on newline with optional indent
440441
*/
441-
const reservedDependentClauses = ['WHEN', 'THEN', 'ELSE'];
442+
const reservedDependentClauses = ['WHEN', 'ELSE'];
442443

443444
export default class PlSqlFormatter extends Formatter {
444445
static reservedCommands = reservedCommands;

src/languages/postgresql.formatter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1284,6 +1284,7 @@ const reservedKeywords = [
12841284
'TEMP',
12851285
'TEMPLATE',
12861286
'TEMPORARY',
1287+
'THEN',
12871288
'THROUGH',
12881289
'TIES',
12891290
'TIME',
@@ -1616,7 +1617,7 @@ const reservedBinaryCommands = [
16161617
* keywords that follow a previous Statement, must be attached to subsequent data
16171618
* can be fully inline or on newline with optional indent
16181619
*/
1619-
const reservedDependentClauses = ['WHEN', 'THEN', 'ELSE'];
1620+
const reservedDependentClauses = ['WHEN', 'ELSE'];
16201621

16211622
const binaryOperators = [
16221623
'<<',

src/languages/redshift.formatter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ const reservedKeywords = {
463463
'TABLE',
464464
'TAG',
465465
'TDES',
466+
'THEN',
466467
'TIMESTAMP',
467468
'TO',
468469
'TOP',
@@ -711,7 +712,7 @@ const reservedBinaryCommands = [
711712
* keywords that follow a previous Statement, must be attached to subsequent data
712713
* can be fully inline or on newline with optional indent
713714
*/
714-
const reservedDependentClauses = ['WHEN', 'THEN', 'ELSE'];
715+
const reservedDependentClauses = ['WHEN', 'ELSE'];
715716

716717
// https://docs.aws.amazon.com/redshift/latest/dg/cm_chap_SQLCommandRef.html
717718
export default class RedshiftFormatter extends Formatter {

0 commit comments

Comments
 (0)