Skip to content

Commit 53f75f9

Browse files
committed
add on protocol.ts + renaming
1 parent 590ac4c commit 53f75f9

File tree

6 files changed

+7
-6
lines changed

6 files changed

+7
-6
lines changed

src/harness/fourslash.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ namespace FourSlash {
376376
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false,
377377
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false,
378378
insertSpaceAfterTypeAssertion: false,
379-
indentInsideTernaryOperator: false,
379+
indentConditionalExpressionFalseBranch: false,
380380
placeOpenBraceOnNewLineForFunctions: false,
381381
placeOpenBraceOnNewLineForControlBlocks: false,
382382
};

src/server/protocol.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,6 +2321,7 @@ namespace ts.server.protocol {
23212321
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
23222322
insertSpaceAfterTypeAssertion?: boolean;
23232323
insertSpaceBeforeFunctionParenthesis?: boolean;
2324+
indentConditionalExpressionFalseBranch?: boolean;
23242325
placeOpenBraceOnNewLineForFunctions?: boolean;
23252326
placeOpenBraceOnNewLineForControlBlocks?: boolean;
23262327
}

src/server/utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ namespace ts.server {
9090
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false,
9191
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false,
9292
insertSpaceBeforeFunctionParenthesis: false,
93-
indentInsideTernaryOperator: false,
93+
indentConditionalExpressionFalseBranch: false,
9494
placeOpenBraceOnNewLineForFunctions: false,
9595
placeOpenBraceOnNewLineForControlBlocks: false,
9696
};

src/services/formatting/smartIndenter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ namespace ts.formatting {
512512
case SyntaxKind.JsxElement:
513513
return childKind !== SyntaxKind.JsxClosingElement;
514514
case SyntaxKind.ConditionalExpression:
515-
return options.indentInsideTernaryOperator || (parent as ConditionalExpression).whenFalse !== child;
515+
return options.indentConditionalExpressionFalseBranch || (parent as ConditionalExpression).whenFalse !== child;
516516
}
517517
// No explicit rule for given nodes so the result will follow the default value argument
518518
return indentByDefault;

src/services/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ namespace ts {
472472
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
473473
insertSpaceAfterTypeAssertion?: boolean;
474474
insertSpaceBeforeFunctionParenthesis?: boolean;
475-
indentInsideTernaryOperator?: boolean;
475+
indentConditionalExpressionFalseBranch?: boolean;
476476
placeOpenBraceOnNewLineForFunctions?: boolean;
477477
placeOpenBraceOnNewLineForControlBlocks?: boolean;
478478
}

tests/cases/fourslash/formattingOptionsChangeTernary.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//// ? ScanAction.RescanJsxText
1414
//// : ScanAction.Scan;
1515

16-
format.setOption("indentInsideTernaryOperator", false);
16+
format.setOption("indentConditionalExpressionFalseBranch", false);
1717
format.document();
1818
verify.currentFileContentIs(`const expectedScanAction =
1919
shouldRescanGreaterThanToken(n)
@@ -28,7 +28,7 @@ verify.currentFileContentIs(`const expectedScanAction =
2828
? ScanAction.RescanJsxText
2929
: ScanAction.Scan;`)
3030

31-
format.setOption("indentInsideTernaryOperator", true);
31+
format.setOption("indentConditionalExpressionFalseBranch", true);
3232
format.document();
3333
verify.currentFileContentIs(`const expectedScanAction =
3434
shouldRescanGreaterThanToken(n)

0 commit comments

Comments
 (0)