Skip to content

Commit ebf46a7

Browse files
committed
merge conflict
1 parent 273a0db commit ebf46a7

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

src/harness/fourslash.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3524,11 +3524,11 @@ namespace FourSlashInterface {
35243524
this.state.formatOnType(this.state.getMarkerByName(posMarker).position, key);
35253525
}
35263526

3527-
public setOption(name: string, value: number): void;
3528-
public setOption(name: string, value: string): void;
3529-
public setOption(name: string, value: boolean): void;
3530-
public setOption(name: string, value: any): void {
3531-
(<any>this.state.formatCodeSettings)[name] = value;
3527+
public setOption(name: keyof ts.FormatCodeSettings, value: number): void;
3528+
public setOption(name: keyof ts.FormatCodeSettings, value: string): void;
3529+
public setOption(name: keyof ts.FormatCodeSettings, value: boolean): void;
3530+
public setOption(name: keyof ts.FormatCodeSettings, value: any): void {
3531+
this.state.formatCodeSettings[name] = value;
35323532
}
35333533

35343534
public getOption(name: keyof ts.FormatCodeSettings) {

tests/cases/fourslash/formattingOptionsChange.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
///<reference path="fourslash.ts"/>
22

3-
/////*InsertSpaceAfterCommaDelimiter*/[1,2, 3];[ 72 , ];
4-
/////*InsertSpaceAfterSemicolonInForStatements*/for (i = 0;i; i++);
5-
/////*InsertSpaceBeforeAndAfterBinaryOperators*/1+2- 3
6-
/////*InsertSpaceAfterKeywordsInControlFlowStatements*/if (true) { }
7-
/////*InsertSpaceAfterFunctionKeywordForAnonymousFunctions*/(function () { })
8-
/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis*/(1 )
9-
/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets*/[1 ]; [ ]; []; [,];
10-
/////*InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces*/`${1}`;`${ 1 }`
11-
/////*InsertSpaceAfterTypeAssertion*/const bar = <Bar> Thing.getFoo();
12-
/////*PlaceOpenBraceOnNewLineForFunctions*/class foo {
3+
/////*insertSpaceAfterCommaDelimiter*/[1,2, 3];[ 72 , ];
4+
/////*insertSpaceAfterSemicolonInForStatements*/for (i = 0;i; i++);
5+
/////*insertSpaceBeforeAndAfterBinaryOperators*/1+2- 3
6+
/////*insertSpaceAfterKeywordsInControlFlowStatements*/if (true) { }
7+
/////*insertSpaceAfterFunctionKeywordForAnonymousFunctions*/(function () { })
8+
/////*insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis*/(1 )
9+
/////*insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets*/[1 ]; [ ]; []; [,];
10+
/////*insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces*/`${1}`;`${ 1 }`
11+
/////*insertSpaceAfterTypeAssertion*/const bar = <Bar> Thing.getFoo();
12+
/////*placeOpenBraceOnNewLineForFunctions*/class foo {
1313
////}
14-
/////*PlaceOpenBraceOnNewLineForControlBlocks*/if (true) {
14+
/////*placeOpenBraceOnNewLineForControlBlocks*/if (true) {
1515
////}
16-
/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' };function f( { a, b}) { }
17-
18-
runTest("InsertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];");
19-
runTest("InsertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);");
20-
runTest("InsertSpaceBeforeAndAfterBinaryOperators", "1 + 2 - 3", "1+2-3");
21-
runTest("InsertSpaceAfterKeywordsInControlFlowStatements", "if (true) { }", "if(true) { }");
22-
runTest("InsertSpaceAfterFunctionKeywordForAnonymousFunctions", "(function () { })", "(function() { })");
23-
runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", " ( 1 )", " (1)");
24-
runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets", "[ 1 ];[];[];[ , ];", "[1];[];[];[,];");
25-
runTest("InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }`; `${ 1 }`", "`${1}`; `${1}`");
26-
runTest("InsertSpaceAfterTypeAssertion", "const bar = <Bar> Thing.getFoo();", "const bar = <Bar>Thing.getFoo();");
27-
runTest("PlaceOpenBraceOnNewLineForFunctions", "class foo", "class foo {");
28-
runTest("PlaceOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {");
29-
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}) {}");
16+
/////*insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' };function f( { a, b}) { }
17+
18+
runTest("insertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];");
19+
runTest("insertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);");
20+
runTest("insertSpaceBeforeAndAfterBinaryOperators", "1 + 2 - 3", "1+2-3");
21+
runTest("insertSpaceAfterKeywordsInControlFlowStatements", "if (true) { }", "if(true) { }");
22+
runTest("insertSpaceAfterFunctionKeywordForAnonymousFunctions", "(function () { })", "(function() { })");
23+
runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", " ( 1 )", " (1)");
24+
runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets", "[ 1 ];[];[];[ , ];", "[1];[];[];[,];");
25+
runTest("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }`; `${ 1 }`", "`${1}`; `${1}`");
26+
runTest("insertSpaceAfterTypeAssertion", "const bar = <Bar> Thing.getFoo();", "const bar = <Bar>Thing.getFoo();");
27+
runTest("placeOpenBraceOnNewLineForFunctions", "class foo", "class foo {");
28+
runTest("placeOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {");
29+
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}) {}");
3030

3131
const defaultFormatOption = format.copyFormatOptions();
3232
function runTest(propertyName: string, expectedStringWhenTrue: string, expectedStringWhenFalse: string) {

0 commit comments

Comments
 (0)