From ebf46a77e96b39291897f9787bcd92b8ef92b4f2 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sat, 17 Dec 2016 13:21:34 +0900 Subject: [PATCH] merge conflict --- src/harness/fourslash.ts | 10 ++-- .../fourslash/formattingOptionsChange.ts | 48 +++++++++---------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 35fa7734a58..0be7ecffc34 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -3524,11 +3524,11 @@ namespace FourSlashInterface { this.state.formatOnType(this.state.getMarkerByName(posMarker).position, key); } - public setOption(name: string, value: number): void; - public setOption(name: string, value: string): void; - public setOption(name: string, value: boolean): void; - public setOption(name: string, value: any): void { - (this.state.formatCodeSettings)[name] = value; + public setOption(name: keyof ts.FormatCodeSettings, value: number): void; + public setOption(name: keyof ts.FormatCodeSettings, value: string): void; + public setOption(name: keyof ts.FormatCodeSettings, value: boolean): void; + public setOption(name: keyof ts.FormatCodeSettings, value: any): void { + this.state.formatCodeSettings[name] = value; } public getOption(name: keyof ts.FormatCodeSettings) { diff --git a/tests/cases/fourslash/formattingOptionsChange.ts b/tests/cases/fourslash/formattingOptionsChange.ts index b8d128acb79..f8f7c270cd8 100644 --- a/tests/cases/fourslash/formattingOptionsChange.ts +++ b/tests/cases/fourslash/formattingOptionsChange.ts @@ -1,32 +1,32 @@ /// -/////*InsertSpaceAfterCommaDelimiter*/[1,2, 3];[ 72 , ]; -/////*InsertSpaceAfterSemicolonInForStatements*/for (i = 0;i; i++); -/////*InsertSpaceBeforeAndAfterBinaryOperators*/1+2- 3 -/////*InsertSpaceAfterKeywordsInControlFlowStatements*/if (true) { } -/////*InsertSpaceAfterFunctionKeywordForAnonymousFunctions*/(function () { }) -/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis*/(1 ) -/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets*/[1 ]; [ ]; []; [,]; -/////*InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces*/`${1}`;`${ 1 }` -/////*InsertSpaceAfterTypeAssertion*/const bar = Thing.getFoo(); -/////*PlaceOpenBraceOnNewLineForFunctions*/class foo { +/////*insertSpaceAfterCommaDelimiter*/[1,2, 3];[ 72 , ]; +/////*insertSpaceAfterSemicolonInForStatements*/for (i = 0;i; i++); +/////*insertSpaceBeforeAndAfterBinaryOperators*/1+2- 3 +/////*insertSpaceAfterKeywordsInControlFlowStatements*/if (true) { } +/////*insertSpaceAfterFunctionKeywordForAnonymousFunctions*/(function () { }) +/////*insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis*/(1 ) +/////*insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets*/[1 ]; [ ]; []; [,]; +/////*insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces*/`${1}`;`${ 1 }` +/////*insertSpaceAfterTypeAssertion*/const bar = Thing.getFoo(); +/////*placeOpenBraceOnNewLineForFunctions*/class foo { ////} -/////*PlaceOpenBraceOnNewLineForControlBlocks*/if (true) { +/////*placeOpenBraceOnNewLineForControlBlocks*/if (true) { ////} -/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' };function f( { a, b}) { } +/////*insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' };function f( { a, b}) { } -runTest("InsertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];"); -runTest("InsertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);"); -runTest("InsertSpaceBeforeAndAfterBinaryOperators", "1 + 2 - 3", "1+2-3"); -runTest("InsertSpaceAfterKeywordsInControlFlowStatements", "if (true) { }", "if(true) { }"); -runTest("InsertSpaceAfterFunctionKeywordForAnonymousFunctions", "(function () { })", "(function() { })"); -runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", " ( 1 )", " (1)"); -runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets", "[ 1 ];[];[];[ , ];", "[1];[];[];[,];"); -runTest("InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }`; `${ 1 }`", "`${1}`; `${1}`"); -runTest("InsertSpaceAfterTypeAssertion", "const bar = Thing.getFoo();", "const bar = Thing.getFoo();"); -runTest("PlaceOpenBraceOnNewLineForFunctions", "class foo", "class foo {"); -runTest("PlaceOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {"); -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}) {}"); +runTest("insertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];"); +runTest("insertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);"); +runTest("insertSpaceBeforeAndAfterBinaryOperators", "1 + 2 - 3", "1+2-3"); +runTest("insertSpaceAfterKeywordsInControlFlowStatements", "if (true) { }", "if(true) { }"); +runTest("insertSpaceAfterFunctionKeywordForAnonymousFunctions", "(function () { })", "(function() { })"); +runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", " ( 1 )", " (1)"); +runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets", "[ 1 ];[];[];[ , ];", "[1];[];[];[,];"); +runTest("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }`; `${ 1 }`", "`${1}`; `${1}`"); +runTest("insertSpaceAfterTypeAssertion", "const bar = Thing.getFoo();", "const bar = Thing.getFoo();"); +runTest("placeOpenBraceOnNewLineForFunctions", "class foo", "class foo {"); +runTest("placeOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {"); +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}) {}"); const defaultFormatOption = format.copyFormatOptions(); function runTest(propertyName: string, expectedStringWhenTrue: string, expectedStringWhenFalse: string) {