From e5279fd828fbc7f88ddc9c1f4d44e1cfc7221200 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 2 Nov 2016 12:38:33 -0700 Subject: [PATCH] Rename and simplify fourslash interface --- src/harness/fourslash.ts | 50 ++++++++++--------- tests/cases/fourslash/codeFixAddSuperCall.ts | 2 +- .../codeFixChangeExtendsToImplementsFS1.ts | 2 +- .../codeFixChangeExtendsToImplementsFS2.ts | 2 +- .../codeFixClassExtendsAbstractFunction.ts | 2 +- .../codeFixClassExtendsAbstractNumber.ts | 2 +- ...eFixClassExtendsAbstractProtectedNumber.ts | 2 +- ...codeFixClassExtendsAbstractPublicNumber.ts | 2 +- .../codeFixInterfaceInExtendsClause.ts | 15 ++---- tests/cases/fourslash/codeFixReOrderSuper.ts | 2 +- .../codeFixUnImplementedInterface36.ts | 2 +- .../codeFixUnImplementedInterface37.ts | 2 +- .../codeFixUnImplementedInterface39.ts | 2 +- ...stractFunctionGenericParamExtendsNumber.ts | 2 +- ...ericParamExtendsNumberViaHeritageClause.ts | 2 +- ...ricParamExtendsNumberViaHeritageClause2.ts | 2 +- ...ctFunctionGenericParamViaHeritageClause.ts | 2 +- ...issingAbstractFunctionViaHeritageClause.ts | 2 +- ...ixUnImplementedInterfaceMissingFunction.ts | 2 +- ...entedInterfaceMissingFunctionAndExtends.ts | 2 +- ...tedInterfaceMissingFunctionFromAbstract.ts | 2 +- ...ctionFromAbstractClassViaHeritageClause.ts | 2 +- ...rfaceMissingFunctionFromHeritageClause1.ts | 2 +- ...rfaceMissingFunctionFromHeritageClause2.ts | 2 +- ...rfaceMissingFunctionFromHeritageClause3.ts | 2 +- ...rfaceMissingFunctionFromHeritageClause4.ts | 2 +- ...issingFunctionGenericParamExtendsString.ts | 2 +- ...edInterfaceMissingFunctionGenericParams.ts | 2 +- ...ntedInterfaceMissingFunctionNoSemicolon.ts | 2 +- ...entedInterfaceMissingFunctionWithParams.ts | 2 +- ...InterfaceMissingFunctionWithParamsClass.ts | 2 +- ...eFixUnImplementedInterfaceMissingNumber.ts | 2 +- ...mentedInterfaceMissingNumberNoSemicolon.ts | 2 +- ...mentedInterfaceMissingMultipleFunctions.ts | 2 +- ...MissingMultipleFunctionsDeepInheritance.ts | 2 +- tests/cases/fourslash/fourslash.ts | 6 +-- .../fourslash/server/codeFixAddSuperCall.ts | 10 ---- 37 files changed, 67 insertions(+), 80 deletions(-) delete mode 100644 tests/cases/fourslash/server/codeFixAddSuperCall.ts diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index c2f9dee0e7c..e8e5c8e9597 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -92,11 +92,14 @@ namespace FourSlash { end: number; } - export interface ErrorIdentifier { + export interface CodeFixIdentifier { + /** + * Error code to search over for codefix. + */ code: number; /** * In a file where there is more than one error with code `code`, `count` refers - * to which 0-indexed error, sorted by order of occurence, to consider. + * to which 0-indexed codefix, sorted by order of occurence, to consider. */ count: number; } @@ -2022,14 +2025,14 @@ namespace FourSlash { * Because codefixes are only applied on the working file, it is unsafe * to apply this more than once (consider a refactoring across files). */ - public verifyCodeFixAtPosition(expectedText: string, errorCode?: number) { + public verifyRangeAfterCodeFix(expectedText: string, codeFixIdentifier?: CodeFixIdentifier) { const ranges = this.getRanges(); if (ranges.length !== 1) { this.raiseError("Exactly one range should be specified in the testfile."); } const fileName = this.activeFile.fileName; - const codeFix: ts.CodeAction = this.getCodeFix(fileName, errorCode ? { code: errorCode, count: 0 } : undefined); + const codeFix: ts.CodeAction = this.getCodeFix(fileName, codeFixIdentifier); if (!codeFix) { this.raiseError("Should find exactly one codefix."); @@ -2052,6 +2055,8 @@ namespace FourSlash { * Applies fixes for the errors in fileName and compares the results to * expectedContents after all fixes have been applied. * + * It is safe to apply this multiple times in a single test. + * * Note: applying one codefix may generate another (eg: remove duplicate implements * may generate an extends -> interface conversion fix). * @param expectedContents The contents of the file after the fixes are applied. @@ -2059,30 +2064,27 @@ namespace FourSlash { * @param errorsToFix An array of errors for which quickfixes will be applied. If not * supplied, all codefixes in the file are applied until none are left, starting from * the first available codefix. - * + * */ - public verifyFileAfterCodeFix(expectedContents: string, fileName?: string, errorsToFix?: ErrorIdentifier[]) { + public verifyFileAfterCodeFix(expectedContents: string, fileName?: string, codeFixIdentifier?: CodeFixIdentifier) { fileName = fileName ? fileName : this.activeFile.fileName; - if (errorsToFix) { - for (const error of errorsToFix) { - const fix = this.getCodeFix(fileName, error); - if (fix === undefined) { - this.raiseError(`Couldn't find the ${error.count}'th error with code ${error.code}.`); - } - this.applyCodeAction(fix); + const codeFix = this.getCodeFix(fileName, codeFixIdentifier); + + if (codeFix === undefined) { + if (codeFixIdentifier) { + this.raiseError(`Couldn't find the ${codeFixIdentifier.count}'th error with code ${codeFixIdentifier.code}.`); } - } - else { - let fix: ts.CodeAction; - while (fix = this.getCodeFix(fileName)) { - this.applyCodeAction(fix); + else { + this.raiseError("No code fix could be found."); } } + this.applyCodeAction(codeFix); + const actualContents: string = this.getFileContent(fileName); if (this.removeWhitespace(actualContents) !== this.removeWhitespace(expectedContents)) { - this.raiseError(`Actual text doesn't match expected text. Actual:\n${actualContents}\n\nExpected:\n${expectedContents}`); + this.raiseError(`Actual text doesn't match expected text. Actual:\n${actualContents}\n\nExpected:\n\n${expectedContents}`); } } @@ -2093,7 +2095,7 @@ namespace FourSlash { * * If undefined, we get the first codefix available. */ - private getCodeFix(fileName: string, error?: ErrorIdentifier): ts.CodeAction | undefined { + private getCodeFix(fileName: string, error?: CodeFixIdentifier): ts.CodeAction | undefined { const diagnostics: ts.Diagnostic[] = this.getDiagnostics(fileName); const errorCount = error ? error.count : 0; @@ -3364,12 +3366,12 @@ namespace FourSlashInterface { this.DocCommentTemplate(/*expectedText*/ undefined, /*expectedOffset*/ undefined, /*empty*/ true); } - public codeFixAtPosition(expectedText: string, errorCode?: number): void { - this.state.verifyCodeFixAtPosition(expectedText, errorCode); + public rangeAfterCodeFix(expectedText: string, codeFixidentifier?: FourSlash.CodeFixIdentifier): void { + this.state.verifyRangeAfterCodeFix(expectedText, codeFixidentifier); } - public fileAfterCodeFixes(expectedContents: string, fileName?: string, errorsToFix?: FourSlash.ErrorIdentifier[]): void { - this.state.verifyFileAfterCodeFix(expectedContents, fileName, errorsToFix); + public fileAfterCodeFix(expectedContents: string, fileName?: string, codeFixidentifier?: FourSlash.CodeFixIdentifier): void { + this.state.verifyFileAfterCodeFix(expectedContents, fileName, codeFixidentifier); } public navigationBar(json: any) { diff --git a/tests/cases/fourslash/codeFixAddSuperCall.ts b/tests/cases/fourslash/codeFixAddSuperCall.ts index 7fbe2cb4fd7..0f5117cb487 100644 --- a/tests/cases/fourslash/codeFixAddSuperCall.ts +++ b/tests/cases/fourslash/codeFixAddSuperCall.ts @@ -7,4 +7,4 @@ //// } ////} -verify.codeFixAtPosition('super();'); +verify.rangeAfterCodeFix('super();'); diff --git a/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS1.ts b/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS1.ts index a5b9a6375b6..6721eda7367 100644 --- a/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS1.ts +++ b/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS1.ts @@ -3,4 +3,4 @@ //// interface I1 {} //// [|class c1 extends I1|]{} -verify.codeFixAtPosition("class c1 implements I1"); \ No newline at end of file +verify.rangeAfterCodeFix("class c1 implements I1"); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS2.ts b/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS2.ts index b63ab3032eb..973795732ad 100644 --- a/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS2.ts +++ b/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS2.ts @@ -3,4 +3,4 @@ ////interface I1 {} ////[|class c1 extends I1|]{} -verify.codeFixAtPosition("class c1 implements I1"); \ No newline at end of file +verify.rangeAfterCodeFix("class c1 implements I1"); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts index 6bed7a3fe0f..a946d6386a0 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts @@ -7,7 +7,7 @@ //// class C extends A {[| //// |]} -verify.codeFixAtPosition(`f(){ +verify.rangeAfterCodeFix(`f(){ throw new Error('Method not Implemented'); } `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts index f57017693cd..0fa6dd3dc51 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts @@ -7,6 +7,6 @@ //// class C extends A {[| //// |]} -verify.codeFixAtPosition(` +verify.rangeAfterCodeFix(` abstract x: number; `); diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts index 2f1a0f4b64e..dae05f58ac2 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts @@ -7,6 +7,6 @@ //// class C extends A {[| //// |]} -verify.codeFixAtPosition(` +verify.rangeAfterCodeFix(` protected abstract x: number; `); diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts index 380f23f6c58..2862c329235 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts @@ -7,6 +7,6 @@ //// class C extends A {[| //// |]} -verify.codeFixAtPosition(` +verify.rangeAfterCodeFix(` public abstract x: number; `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts b/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts index 82debc0109a..15b6833d899 100644 --- a/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts +++ b/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts @@ -1,14 +1,9 @@ /// -//// interface I1 { } -//// class C1 extends I1 { } -//// interface I2 { } -//// class C2 extends I2 { } +//// interface I { } +//// class C extends I { } -// verify.codeFixAvailable(); -verify.fileAfterCodeFixes(` -interface I1 { } -class C1 implements I1 { } -interface I2 { } -class C2 implements I2 { } +verify.fileAfterCodeFix(` +interface I { } +class C implements I { } `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixReOrderSuper.ts b/tests/cases/fourslash/codeFixReOrderSuper.ts index 880b5d43167..2bff98ceca0 100644 --- a/tests/cases/fourslash/codeFixReOrderSuper.ts +++ b/tests/cases/fourslash/codeFixReOrderSuper.ts @@ -10,4 +10,4 @@ //// } ////} -verify.codeFixAtPosition("super(); this.a = 12;"); \ No newline at end of file +verify.rangeAfterCodeFix("super(); this.a = 12;"); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface36.ts b/tests/cases/fourslash/codeFixUnImplementedInterface36.ts index 3871414428e..17f889b56bf 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterface36.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterface36.ts @@ -14,7 +14,7 @@ //// //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface37.ts b/tests/cases/fourslash/codeFixUnImplementedInterface37.ts index 2032f2d3461..3ff689d455e 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterface37.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterface37.ts @@ -14,7 +14,7 @@ //// //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface39.ts b/tests/cases/fourslash/codeFixUnImplementedInterface39.ts index ae85d02b8a3..fcc43ba6259 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterface39.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterface39.ts @@ -12,7 +12,7 @@ //// class C1 implements N1.I1 {[| //// |]} -verify.codeFixAtPosition(`f1():string{ +verify.rangeAfterCodeFix(`f1():string{ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumber.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumber.ts index ab7a4f30bea..5a644dfb993 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumber.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumber.ts @@ -8,7 +8,7 @@ //// //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause.ts index 7c3a647ce40..083f4301a11 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause.ts @@ -12,7 +12,7 @@ //// |]f2(){} //// } -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause2.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause2.ts index 66d47491c41..aaa00cc791a 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause2.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause2.ts @@ -10,7 +10,7 @@ //// //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamViaHeritageClause.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamViaHeritageClause.ts index 825224f448b..24c9048015e 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamViaHeritageClause.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamViaHeritageClause.ts @@ -12,7 +12,7 @@ //// |]f2(){} //// } -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionViaHeritageClause.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionViaHeritageClause.ts index d56e44911b5..b7b7271badd 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionViaHeritageClause.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionViaHeritageClause.ts @@ -12,7 +12,7 @@ //// |]f2(){} //// } -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunction.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunction.ts index b07db08f12a..0459b90c99c 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunction.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunction.ts @@ -12,7 +12,7 @@ //// class C1 implements N1.I1 {[| //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionAndExtends.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionAndExtends.ts index 5c869996773..36f1c11dc82 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionAndExtends.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionAndExtends.ts @@ -11,7 +11,7 @@ //// class C1 implements I2 {[| //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstract.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstract.ts index c2719c2e7f9..4b17f315534 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstract.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstract.ts @@ -8,7 +8,7 @@ //// |]f2(){} //// } -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstractClassViaHeritageClause.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstractClassViaHeritageClause.ts index 71addef195b..7cbc606539b 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstractClassViaHeritageClause.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstractClassViaHeritageClause.ts @@ -12,7 +12,7 @@ //// |]f2(){} //// } -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause1.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause1.ts index c6c2998ac9a..a6f7c5cdba7 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause1.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause1.ts @@ -11,7 +11,7 @@ //// class C1 implements I2 {[| //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause2.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause2.ts index 3c819f6b56e..01da0838679 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause2.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause2.ts @@ -13,7 +13,7 @@ //// class C1 implements I3 {[| //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause3.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause3.ts index 4e9e428fd6d..ff91223f63a 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause3.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause3.ts @@ -13,7 +13,7 @@ //// class C1 implements I3 {[| //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause4.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause4.ts index fdb0fa1230c..390a249f7c8 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause4.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause4.ts @@ -13,7 +13,7 @@ //// class C1 implements I3 {[| //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParamExtendsString.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParamExtendsString.ts index 2df93c6d7d9..abf5848668e 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParamExtendsString.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParamExtendsString.ts @@ -9,7 +9,7 @@ //// class C1 implements I1 {[| //// |]} -verify.codeFixAtPosition(`f1(x: number,y: C2){ +verify.rangeAfterCodeFix(`f1(x: number,y: C2){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParams.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParams.ts index 125f3e1ffeb..51becc8c99c 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParams.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParams.ts @@ -9,7 +9,7 @@ //// class C1 implements I1 {[| //// |]} -verify.codeFixAtPosition(`f1(x: number,y: C2){ +verify.rangeAfterCodeFix(`f1(x: number,y: C2){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionNoSemicolon.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionNoSemicolon.ts index 6e4e64c18d1..5b5f177741c 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionNoSemicolon.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionNoSemicolon.ts @@ -12,7 +12,7 @@ //// class C1 implements N1.I1 {[| //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParams.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParams.ts index 59b3ba85199..5a4537ff2d5 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParams.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParams.ts @@ -12,7 +12,7 @@ //// class C1 implements N1.I1 {[| //// |]} -verify.codeFixAtPosition(`f1(x: number,y: string){ +verify.rangeAfterCodeFix(`f1(x: number,y: string){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParamsClass.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParamsClass.ts index 2310e05fbb0..157c9bec04e 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParamsClass.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParamsClass.ts @@ -9,7 +9,7 @@ //// class C1 implements I1 {[| //// |]} -verify.codeFixAtPosition(`f1(x: number,y: T){ +verify.rangeAfterCodeFix(`f1(x: number,y: T){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumber.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumber.ts index 394c54d4687..e8a30703638 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumber.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumber.ts @@ -12,5 +12,5 @@ //// class C1 implements N1.I1 {[| //// |]} -verify.codeFixAtPosition(`x: number; +verify.rangeAfterCodeFix(`x: number; `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumberNoSemicolon.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumberNoSemicolon.ts index 19354ce1c94..f9aeb194fd7 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumberNoSemicolon.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumberNoSemicolon.ts @@ -12,5 +12,5 @@ //// class C1 implements N1.I1 {[| //// |]} -verify.codeFixAtPosition(`x: number; +verify.rangeAfterCodeFix(`x: number; `); diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts index 02415491191..165edc92584 100644 --- a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts @@ -13,7 +13,7 @@ //// class C3 implements I1 {[| //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } f2(){ diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts index fcb990ac27f..e8b199b21af 100644 --- a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts @@ -52,7 +52,7 @@ */ -verify.codeFixAtPosition( +verify.rangeAfterCodeFix( ` e: number; f: number; diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 3b5c0c1e897..356bc449c3b 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -98,7 +98,7 @@ declare namespace FourSlashInterface { start: number; end: number; } - interface ErrorIdentifier { + interface CodeFixIdentifier { code: number; count: number } @@ -213,8 +213,8 @@ declare namespace FourSlashInterface { noMatchingBracePositionInCurrentFile(bracePosition: number): void; DocCommentTemplate(expectedText: string, expectedOffset: number, empty?: boolean): void; noDocCommentTemplate(): void; - codeFixAtPosition(expectedText: string, errorCode?: number): void; - fileAfterCodeFixes(expectedContents: string, fileName?: string, errorsToFix?: ErrorIdentifier[]): void; + rangeAfterCodeFix(expectedText: string, CodeFixIdentifier?: CodeFixIdentifier): void; + fileAfterCodeFix(expectedContents: string, fileName?: string, CodeFixIdentifier?: CodeFixIdentifier): void; navigationBar(json: any): void; navigationTree(json: any): void; diff --git a/tests/cases/fourslash/server/codeFixAddSuperCall.ts b/tests/cases/fourslash/server/codeFixAddSuperCall.ts deleted file mode 100644 index 7fbe2cb4fd7..00000000000 --- a/tests/cases/fourslash/server/codeFixAddSuperCall.ts +++ /dev/null @@ -1,10 +0,0 @@ -/// - -////class Base{ -////} -////class C extends Base{ -//// constructor() {[| |] -//// } -////} - -verify.codeFixAtPosition('super();');