Skip to content

Commit 5fb8249

Browse files
committed
reposition defaultFormatOption
1 parent 6b48f3b commit 5fb8249

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/server/utilities.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ namespace ts.server {
8686
insertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
8787
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
8888
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
89+
insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true,
8990
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false,
9091
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false,
9192
insertSpaceBeforeFunctionParenthesis: false,

tests/cases/fourslash/formattingOptionsChange.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
////}
1616
/////*insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' };function f( { a, b}) { }
1717

18+
const defaultFormatOption = format.copyFormatOptions();
19+
1820
runTest("insertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];");
1921
runTest("insertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);");
2022
runTest("insertSpaceBeforeAndAfterBinaryOperators", "1 + 2 - 3", "1+2-3");
@@ -25,10 +27,9 @@ runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets", "[ 1 ];[];[];
2527
runTest("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }`; `${ 1 }`", "`${1}`; `${1}`");
2628
runTest("insertSpaceAfterTypeAssertion", "const bar = <Bar> Thing.getFoo();", "const bar = <Bar>Thing.getFoo();");
2729
runTest("placeOpenBraceOnNewLineForFunctions", "class foo", "class foo {");
28-
runTest("placeOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {");
30+
runTest("placeOpenBraceOnNewLineForControlBlocks", "if (true)", "if (true) {");
2931
runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 }; var { a, b } = { a: 'sw', b: 'r' }; function f({ a, b }) { }", "{var t = 1}; var {a, b} = {a: 'sw', b: 'r'}; function f({a, b}) {}");
3032

31-
const defaultFormatOption = format.copyFormatOptions();
3233
function runTest(propertyName: string, expectedStringWhenTrue: string, expectedStringWhenFalse: string) {
3334
// Go to the correct file
3435
goTo.marker(propertyName);

0 commit comments

Comments
 (0)