From f9bebfb4f6af8292fed718b02716ae2d4d2e7366 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 25 Sep 2017 08:22:16 -0700 Subject: [PATCH] Replace more 'verify.rangeAfterCodeFix' with 'verify.codeFix' --- src/compiler/diagnosticMessages.json | 2 +- src/harness/fourslash.ts | 2 +- .../codeFixChangeExtendsToImplements.ts | 5 +- ...angeExtendsToImplementsAbstractModifier.ts | 6 ++- ...eFixChangeExtendsToImplementsTypeParams.ts | 5 +- ...xChangeExtendsToImplementsWithDecorator.ts | 6 ++- .../fourslash/codeFixChangeJSDocSyntax1.ts | 5 +- .../fourslash/codeFixChangeJSDocSyntax10.ts | 8 ++- .../fourslash/codeFixChangeJSDocSyntax11.ts | 8 ++- .../fourslash/codeFixChangeJSDocSyntax12.ts | 8 ++- .../fourslash/codeFixChangeJSDocSyntax13.ts | 8 ++- .../fourslash/codeFixChangeJSDocSyntax14.ts | 7 ++- .../fourslash/codeFixChangeJSDocSyntax15.ts | 7 ++- .../fourslash/codeFixChangeJSDocSyntax16.ts | 5 +- .../fourslash/codeFixChangeJSDocSyntax17.ts | 6 ++- .../fourslash/codeFixChangeJSDocSyntax18.ts | 6 ++- .../fourslash/codeFixChangeJSDocSyntax19.ts | 6 ++- .../fourslash/codeFixChangeJSDocSyntax2.ts | 5 +- .../fourslash/codeFixChangeJSDocSyntax20.ts | 6 ++- .../fourslash/codeFixChangeJSDocSyntax21.ts | 6 ++- .../fourslash/codeFixChangeJSDocSyntax22.ts | 6 ++- .../fourslash/codeFixChangeJSDocSyntax23.ts | 6 ++- .../fourslash/codeFixChangeJSDocSyntax24.ts | 6 ++- .../fourslash/codeFixChangeJSDocSyntax25.ts | 6 ++- .../fourslash/codeFixChangeJSDocSyntax26.ts | 6 ++- .../fourslash/codeFixChangeJSDocSyntax27.ts | 6 ++- .../fourslash/codeFixChangeJSDocSyntax3.ts | 5 +- .../fourslash/codeFixChangeJSDocSyntax4.ts | 5 +- .../fourslash/codeFixChangeJSDocSyntax5.ts | 7 ++- .../fourslash/codeFixChangeJSDocSyntax6.ts | 6 ++- .../fourslash/codeFixChangeJSDocSyntax7.ts | 5 +- .../fourslash/codeFixChangeJSDocSyntax8.ts | 5 +- .../fourslash/codeFixChangeJSDocSyntax9.ts | 5 +- ...ClassImplementClassFunctionVoidInferred.ts | 21 ++++---- ...prExtendsAbstractExpressionWithTypeArgs.ts | 23 ++++---- ...assExtendAbstractExpressionWithTypeArgs.ts | 23 ++++---- .../codeFixClassExtendAbstractGetterSetter.ts | 53 ++++++++++--------- .../codeFixClassExtendAbstractMethod.ts | 33 ++++++------ .../codeFixClassExtendAbstractMethodThis.ts | 19 ++++--- ...stractMethodTypeParamsInstantiateNumber.ts | 18 ++++--- ...endAbstractMethodTypeParamsInstantiateU.ts | 18 ++++--- .../codeFixClassExtendAbstractProperty.ts | 19 ++++--- tests/cases/fourslash/unusedMethodInClass1.ts | 11 ++-- tests/cases/fourslash/unusedMethodInClass2.ts | 12 +++-- tests/cases/fourslash/unusedMethodInClass3.ts | 11 ++-- tests/cases/fourslash/unusedMethodInClass4.ts | 8 ++- tests/cases/fourslash/unusedMethodInClass5.ts | 11 ++-- tests/cases/fourslash/unusedMethodInClass6.ts | 11 ++-- .../fourslash/unusedNamespaceInNamespace.ts | 16 +++--- .../unusedParameterInConstructor1.ts | 6 ++- ...sedParameterInConstructor1AddUnderscore.ts | 6 ++- .../unusedParameterInConstructor2.ts | 6 ++- .../unusedParameterInConstructor3.ts | 6 ++- .../unusedParameterInConstructor4.ts | 6 ++- .../fourslash/unusedParameterInFunction1.ts | 6 ++- ...unusedParameterInFunction1AddUnderscore.ts | 6 ++- .../fourslash/unusedParameterInFunction2.ts | 6 ++- .../fourslash/unusedParameterInFunction3.ts | 6 ++- .../fourslash/unusedParameterInFunction4.ts | 6 ++- .../fourslash/unusedParameterInLambda1.ts | 6 ++- .../unusedParameterInLambda1AddUnderscore.ts | 6 ++- .../fourslash/unusedTypeAliasInNamespace1.ts | 15 +++--- .../fourslash/unusedTypeParametersInClass1.ts | 5 +- .../fourslash/unusedTypeParametersInClass2.ts | 5 +- .../fourslash/unusedTypeParametersInClass3.ts | 5 +- .../unusedTypeParametersInFunction1.ts | 5 +- .../unusedTypeParametersInFunction2.ts | 5 +- .../unusedTypeParametersInFunction3.ts | 5 +- .../unusedTypeParametersInInterface1.ts | 5 +- .../unusedTypeParametersInLambda1.ts | 5 +- .../unusedTypeParametersInLambda2.ts | 5 +- .../unusedTypeParametersInLambda3.ts | 5 +- .../unusedTypeParametersInLambda4.ts | 5 +- .../unusedTypeParametersInMethod1.ts | 5 +- .../unusedTypeParametersInMethod2.ts | 5 +- .../unusedTypeParametersInMethods1.ts | 5 +- .../cases/fourslash/unusedVariableInBlocks.ts | 15 +++--- .../cases/fourslash/unusedVariableInClass1.ts | 5 +- .../cases/fourslash/unusedVariableInClass2.ts | 5 +- .../cases/fourslash/unusedVariableInClass3.ts | 5 +- .../fourslash/unusedVariableInForLoop1FS.ts | 6 ++- .../fourslash/unusedVariableInForLoop2FS.ts | 5 +- .../fourslash/unusedVariableInForLoop3FS.ts | 5 +- .../fourslash/unusedVariableInForLoop4FS.ts | 5 +- ...unusedVariableInForLoop5FSAddUnderscore.ts | 5 +- .../fourslash/unusedVariableInForLoop6FS.ts | 7 ++- ...unusedVariableInForLoop6FSAddUnderscore.ts | 6 ++- .../fourslash/unusedVariableInForLoop7FS.ts | 7 ++- .../fourslash/unusedVariableInModule1.ts | 5 +- .../fourslash/unusedVariableInModule2.ts | 5 +- .../fourslash/unusedVariableInModule3.ts | 5 +- .../fourslash/unusedVariableInModule4.ts | 6 ++- .../fourslash/unusedVariableInNamespace1.ts | 5 +- .../fourslash/unusedVariableInNamespace2.ts | 5 +- .../fourslash/unusedVariableInNamespace3.ts | 5 +- 95 files changed, 543 insertions(+), 224 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index bf8fcdc4f84b3..ce537f1f7a03e 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3637,7 +3637,7 @@ "category": "Message", "code": 90013 }, - "Change {0} to {1}.": { + "Change '{0}' to '{1}'.": { "category": "Message", "code": 90014 }, diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 13db228e8898c..e8245304c5288 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -2382,7 +2382,7 @@ namespace FourSlash { })); return ts.flatMap(ts.deduplicate(diagnosticsForCodeFix, ts.equalOwnProperties), diagnostic => { - if (errorCode && errorCode !== diagnostic.code) { + if (errorCode !== undefined && errorCode !== diagnostic.code) { return; } diff --git a/tests/cases/fourslash/codeFixChangeExtendsToImplements.ts b/tests/cases/fourslash/codeFixChangeExtendsToImplements.ts index bfaedf2818a9e..bf3b8b7b8a48c 100644 --- a/tests/cases/fourslash/codeFixChangeExtendsToImplements.ts +++ b/tests/cases/fourslash/codeFixChangeExtendsToImplements.ts @@ -3,4 +3,7 @@ //// interface I {} //// [|/* */ class /* */ C /* */ extends /* */ I|]{} -verify.rangeAfterCodeFix("/* */ class /* */ C /* */ implements /* */ I"); \ No newline at end of file +verify.codeFix({ + description: "Change 'extends' to 'implements'.", + newRangeContent: "/* */ class /* */ C /* */ implements /* */ I", +}); diff --git a/tests/cases/fourslash/codeFixChangeExtendsToImplementsAbstractModifier.ts b/tests/cases/fourslash/codeFixChangeExtendsToImplementsAbstractModifier.ts index 5f5ca93c28fc8..7f309a2296582 100644 --- a/tests/cases/fourslash/codeFixChangeExtendsToImplementsAbstractModifier.ts +++ b/tests/cases/fourslash/codeFixChangeExtendsToImplementsAbstractModifier.ts @@ -5,4 +5,8 @@ //// [|abstract class A extends I1 implements I2|] { } -verify.rangeAfterCodeFix("abstract class A implements I1, I2"); \ No newline at end of file +verify.codeFix({ + description: "Change 'extends' to 'implements'.", + // TODO: GH#18794 + newRangeContent: "abstract class A implements I1 , I2", +}); diff --git a/tests/cases/fourslash/codeFixChangeExtendsToImplementsTypeParams.ts b/tests/cases/fourslash/codeFixChangeExtendsToImplementsTypeParams.ts index 869bd1a5dc0a0..2cca0b277fd8f 100644 --- a/tests/cases/fourslash/codeFixChangeExtendsToImplementsTypeParams.ts +++ b/tests/cases/fourslash/codeFixChangeExtendsToImplementsTypeParams.ts @@ -3,4 +3,7 @@ ////interface I { x: X} ////[|class C extends I|]{} -verify.rangeAfterCodeFix("class C implements I"); \ No newline at end of file +verify.codeFix({ + description: "Change 'extends' to 'implements'.", + newRangeContent: "class C implements I", +}); diff --git a/tests/cases/fourslash/codeFixChangeExtendsToImplementsWithDecorator.ts b/tests/cases/fourslash/codeFixChangeExtendsToImplementsWithDecorator.ts index 9671f41def335..e031251ac1b42 100644 --- a/tests/cases/fourslash/codeFixChangeExtendsToImplementsWithDecorator.ts +++ b/tests/cases/fourslash/codeFixChangeExtendsToImplementsWithDecorator.ts @@ -10,4 +10,8 @@ //// @sealed //// [|class A extends I1 implements I2 { }|] -verify.rangeAfterCodeFix("class A implements I1, I2 { }"); \ No newline at end of file +verify.codeFix({ + description: "Change 'extends' to 'implements'.", + // TODO: GH#18794 + newRangeContent: "class A implements I1 , I2 { }", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax1.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax1.ts index 93107ef669bb8..1a4e967df45bc 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax1.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax1.ts @@ -1,4 +1,7 @@ /// //// var x: [|?|] = 12; -verify.rangeAfterCodeFix("any"); +verify.codeFix({ + description: "Change '?' to 'any'.", + newRangeContent: "any", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax10.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax10.ts index 3e6754588fd70..12ddb66c6fd51 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax10.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax10.ts @@ -2,4 +2,10 @@ /// //// function f(x: [|number?|]) { //// } -verify.rangeAfterCodeFix("number | null", /*includeWhiteSpace*/ false, /*errorCode*/ 8020, 0); + +verify.codeFix({ + description: "Change 'number?' to 'number | null'.", + errorCode: 8020, + index: 0, + newRangeContent: "number | null", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax11.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax11.ts index 7ac80125775a9..8edcbb35da297 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax11.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax11.ts @@ -2,4 +2,10 @@ /// //// var f = function f(x: [|string?|]) { //// } -verify.rangeAfterCodeFix("string | null | undefined", /*includeWhiteSpace*/ false, /*errorCode*/ 8020, 1); + +verify.codeFix({ + description: "Change 'string?' to 'string | null | undefined'.", + errorCode: 8020, + index: 1, + newRangeContent: "string | null | undefined", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax12.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax12.ts index 37eb5df41ee8a..a2221897aa877 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax12.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax12.ts @@ -3,4 +3,10 @@ ////class C { //// p: [|*|] ////} -verify.rangeAfterCodeFix("any", /*includeWhiteSpace*/ false, /*errorCode*/ 8020, 0); + +verify.codeFix({ + description: "Change '*' to 'any'.", + errorCode: 8020, + index: 0, + newRangeContent: "any", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax13.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax13.ts index 5b374b508f14c..65fef47feda11 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax13.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax13.ts @@ -3,4 +3,10 @@ ////class C { //// p: [|*|] = 12 ////} -verify.rangeAfterCodeFix("any", /*includeWhiteSpace*/ false, /*errorCode*/ 8020, 0); + +verify.codeFix({ + description: "Change '*' to 'any'.", + errorCode: 8020, + index: 0, + newRangeContent: "any", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax14.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax14.ts index 69478fc3abca0..71f21dd83013c 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax14.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax14.ts @@ -2,4 +2,9 @@ /// //// var x = 12 as [|number?|]; -verify.rangeAfterCodeFix("number | null", /*includeWhiteSpace*/ false, /*errorCode*/ 8020, 0); +verify.codeFix({ + description: "Change 'number?' to 'number | null'.", + errorCode: 8020, + index: 0, + newRangeContent: "number | null", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax15.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax15.ts index 9482830c19dfc..b0e8c069e1e05 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax15.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax15.ts @@ -2,4 +2,9 @@ //// var f = <[|function(number?): number|]>(x => x); // note: without --strict, number? --> number, not number | null -verify.rangeAfterCodeFix("(arg0: number) => number", /*includeWhiteSpace*/ false, /*errorCode*/ 8020, 0); +verify.codeFix({ + description: "Change 'function(number?): number' to '(arg0: number) => number'.", + errorCode: 8020, + index: 0, + newRangeContent: "(arg0: number) => number", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax16.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax16.ts index 111aec1dce77f..264e490d961cc 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax16.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax16.ts @@ -1,4 +1,7 @@ /// //// var f: { [K in keyof number]: [|*|] }; -verify.rangeAfterCodeFix("any"); +verify.codeFix({ + description: "Change '*' to 'any'.", + newRangeContent: "any", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax17.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax17.ts index 6a3ce2ed3df5b..63973222a8acb 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax17.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax17.ts @@ -1,3 +1,7 @@ /// //// declare function index(ix: number): [|*|]; -verify.rangeAfterCodeFix("any"); + +verify.codeFix({ + description: "Change '*' to 'any'.", + newRangeContent: "any", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax18.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax18.ts index 30a3815516a70..31b04bef0f603 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax18.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax18.ts @@ -1,3 +1,7 @@ /// //// var index: { (ix: number): [|?|] }; -verify.rangeAfterCodeFix("any"); + +verify.codeFix({ + description: "Change '?' to 'any'.", + newRangeContent: "any", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax19.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax19.ts index e6344881227cb..d254cf6d8dd59 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax19.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax19.ts @@ -1,3 +1,7 @@ /// //// var index: { new (ix: number): [|?|] }; -verify.rangeAfterCodeFix("any"); + +verify.codeFix({ + description: "Change '?' to 'any'.", + newRangeContent: "any", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax2.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax2.ts index 333b108538fd5..d2dc0986a59b1 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax2.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax2.ts @@ -1,4 +1,7 @@ /// //// var x: [|*|] = 12; -verify.rangeAfterCodeFix("any"); +verify.codeFix({ + description: "Change '*' to 'any'.", + newRangeContent: "any", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax20.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax20.ts index dc15373084175..32cfe73fd4acf 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax20.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax20.ts @@ -1,3 +1,7 @@ /// //// var index = { get p(): [|*|] { return 12 } }; -verify.rangeAfterCodeFix("any"); + +verify.codeFix({ + description: "Change '*' to 'any'.", + newRangeContent: "any", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax21.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax21.ts index 442414e457756..efb53d53009e3 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax21.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax21.ts @@ -1,3 +1,7 @@ /// //// var index = { set p(x: [|*|]) { } }; -verify.rangeAfterCodeFix("any"); + +verify.codeFix({ + description: "Change '*' to 'any'.", + newRangeContent: "any", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax22.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax22.ts index c575f1ca7ced4..06ff23c3cf589 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax22.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax22.ts @@ -1,3 +1,7 @@ /// //// var index: { [s: string]: [|*|] }; -verify.rangeAfterCodeFix("any"); + +verify.codeFix({ + description: "Change '*' to 'any'.", + newRangeContent: "any", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax23.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax23.ts index 7ab70e18ee7eb..29a49ff641c69 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax23.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax23.ts @@ -3,4 +3,8 @@ //// m(): [|*|] { //// } ////} -verify.rangeAfterCodeFix("any"); + +verify.codeFix({ + description: "Change '*' to 'any'.", + newRangeContent: "any", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax24.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax24.ts index 7ea2d1f6fafc1..6c9a840a373ab 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax24.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax24.ts @@ -2,4 +2,8 @@ ////declare class C { //// m(): [|*|]; ////} -verify.rangeAfterCodeFix("any"); + +verify.codeFix({ + description: "Change '*' to 'any'.", + newRangeContent: "any", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax25.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax25.ts index 6486a70417ef5..74a7ea9fa1813 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax25.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax25.ts @@ -2,4 +2,8 @@ ////declare class C { //// p: [|*|]; ////} -verify.rangeAfterCodeFix("any"); + +verify.codeFix({ + description: "Change '*' to 'any'.", + newRangeContent: "any", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax26.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax26.ts index dc31f1dfffdaa..4287539173a73 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax26.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax26.ts @@ -2,4 +2,8 @@ ////class C { //// p: [|*|] = 12; ////} -verify.rangeAfterCodeFix("any"); + +verify.codeFix({ + description: "Change '*' to 'any'.", + newRangeContent: "any", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax27.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax27.ts index 255976c77677f..f2e5721e24197 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax27.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax27.ts @@ -1,4 +1,8 @@ // @strict: true /// ////type T = [|...number?|]; -verify.rangeAfterCodeFix("(number | null)[]"); + +verify.codeFix({ + description: "Change '...number?' to '(number | null)[]'.", + newRangeContent: "(number | null)[]", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax3.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax3.ts index f3b02cb84f13c..2c804edb615b0 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax3.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax3.ts @@ -1,4 +1,7 @@ /// //// var x: [|......number[][]|] = 12; -verify.rangeAfterCodeFix("number[][][][]"); +verify.codeFix({ + description: "Change '......number[][]' to 'number[][][][]'.", + newRangeContent: "number[][][][]", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax4.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax4.ts index e9522331d389e..f2df4abfd3388 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax4.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax4.ts @@ -1,4 +1,7 @@ /// //// var x: [|Array.|] = 12; -verify.rangeAfterCodeFix("number[]"); +verify.codeFix({ + description: "Change 'Array.' to 'number[]'.", + newRangeContent: "number[]", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax5.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax5.ts index 6f46f3082e13c..39cca325a4cf6 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax5.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax5.ts @@ -2,4 +2,9 @@ /// //// var x: [|?number|] = 12; -verify.rangeAfterCodeFix("number | null", /*includeWhiteSpace*/ false, /*errorCode*/ 8020, 0); +verify.codeFix({ + description: "Change '?number' to 'number | null'.", + errorCode: 8020, + index: 0, + newRangeContent: "number | null", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax6.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax6.ts index 8af9f09d99dd5..da692d723bb36 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax6.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax6.ts @@ -2,4 +2,8 @@ /// //// var x: [|number?|] = 12; -verify.rangeAfterCodeFix("number | null | undefined", /*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 1); +verify.codeFix({ + description: "Change 'number?' to 'number | null | undefined'.", + index: 1, + newRangeContent: "number | null | undefined", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax7.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax7.ts index c80d08b3bac58..1d557896fe9a4 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax7.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax7.ts @@ -1,4 +1,7 @@ /// //// var x: [|!number|] = 12; -verify.rangeAfterCodeFix("number"); +verify.codeFix({ + description: "Change '!number' to 'number'.", + newRangeContent: "number", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax8.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax8.ts index 0fa7ddf229cdb..c35badc88cf30 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax8.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax8.ts @@ -1,4 +1,7 @@ /// //// var x: [|function(this: number, number): string|] = 12; -verify.rangeAfterCodeFix("(this: number, arg1: number) => string"); +verify.codeFix({ + description: "Change 'function(this: number, number): string' to '(this: number, arg1: number) => string'.", + newRangeContent: "(this: number, arg1: number) => string", +}); diff --git a/tests/cases/fourslash/codeFixChangeJSDocSyntax9.ts b/tests/cases/fourslash/codeFixChangeJSDocSyntax9.ts index 061ded158ead8..6ce049b6a42d3 100644 --- a/tests/cases/fourslash/codeFixChangeJSDocSyntax9.ts +++ b/tests/cases/fourslash/codeFixChangeJSDocSyntax9.ts @@ -1,4 +1,7 @@ /// //// var x: [|function(new: number)|] = 12; -verify.rangeAfterCodeFix("new () => number"); +verify.codeFix({ + description: "Change 'function(new: number)' to 'new () => number'.", + newRangeContent: "new () => number", +}); diff --git a/tests/cases/fourslash/codeFixClassExprClassImplementClassFunctionVoidInferred.ts b/tests/cases/fourslash/codeFixClassExprClassImplementClassFunctionVoidInferred.ts index 2568111fb90d8..b582c5e89602e 100644 --- a/tests/cases/fourslash/codeFixClassExprClassImplementClassFunctionVoidInferred.ts +++ b/tests/cases/fourslash/codeFixClassExprClassImplementClassFunctionVoidInferred.ts @@ -1,13 +1,16 @@ /// -//// class A { -//// f() {} -//// } +////class A { +//// f() {} +////} //// -//// let B = class implements A {[| |]} +////let B = class implements A {[| |]} -verify.rangeAfterCodeFix(` -f(): void{ - throw new Error("Method not implemented."); -} -`); +verify.codeFix({ + description: "Implement interface 'A'.", + // TODO: GH#18795 + newRangeContent: `f(): void {\r + throw new Error("Method not implemented.");\r +}\r + ` +}); diff --git a/tests/cases/fourslash/codeFixClassExprExtendsAbstractExpressionWithTypeArgs.ts b/tests/cases/fourslash/codeFixClassExprExtendsAbstractExpressionWithTypeArgs.ts index a7690b4f5bf18..198cb9ea673fa 100644 --- a/tests/cases/fourslash/codeFixClassExprExtendsAbstractExpressionWithTypeArgs.ts +++ b/tests/cases/fourslash/codeFixClassExprExtendsAbstractExpressionWithTypeArgs.ts @@ -1,14 +1,17 @@ /// -//// function foo(a: T) { -//// abstract class C { -//// abstract a: T | U; -//// } -//// return C; -//// } +////function foo(a: T) { +//// abstract class C { +//// abstract a: T | U; +//// } +//// return C; +////} //// -//// let B = class extends foo("s") {[| |]} +////let B = class extends foo("s") {[| |]} -verify.rangeAfterCodeFix(` -a: string | number; -`); +verify.codeFix({ + description: "Implement inherited abstract class.", + // TODO: GH#18795 + newRangeContent: `a: string | number;\r + ` +}); diff --git a/tests/cases/fourslash/codeFixClassExtendAbstractExpressionWithTypeArgs.ts b/tests/cases/fourslash/codeFixClassExtendAbstractExpressionWithTypeArgs.ts index 5796bea6fb485..ed574348b9f43 100644 --- a/tests/cases/fourslash/codeFixClassExtendAbstractExpressionWithTypeArgs.ts +++ b/tests/cases/fourslash/codeFixClassExtendAbstractExpressionWithTypeArgs.ts @@ -1,14 +1,17 @@ /// -//// function foo(a: T) { -//// abstract class C { -//// abstract a: T | U; -//// } -//// return C; -//// } +////function foo(a: T) { +//// abstract class C { +//// abstract a: T | U; +//// } +//// return C; +////} //// -//// class B extends foo("s") {[| |]} +////class B extends foo("s") {[| |]} -verify.rangeAfterCodeFix(` -a: string | number; -`); \ No newline at end of file +verify.codeFix({ + description: "Implement inherited abstract class.", + // TODO: GH#18795 + newRangeContent: `a: string | number;\r + ` +}); diff --git a/tests/cases/fourslash/codeFixClassExtendAbstractGetterSetter.ts b/tests/cases/fourslash/codeFixClassExtendAbstractGetterSetter.ts index bc437c93bcdfc..3522b1d39da17 100644 --- a/tests/cases/fourslash/codeFixClassExtendAbstractGetterSetter.ts +++ b/tests/cases/fourslash/codeFixClassExtendAbstractGetterSetter.ts @@ -1,31 +1,34 @@ /// -//// abstract class A { -//// private _a: string; +////abstract class A { +//// private _a: string; //// -//// abstract get a(): number | string; -//// abstract get b(): this; -//// abstract get c(): A; +//// abstract get a(): number | string; +//// abstract get b(): this; +//// abstract get c(): A; //// -//// abstract set d(arg: number | string); -//// abstract set e(arg: this); -//// abstract set f(arg: A); +//// abstract set d(arg: number | string); +//// abstract set e(arg: this); +//// abstract set f(arg: A); //// -//// abstract get g(): string; -//// abstract set g(newName: string); -//// } -//// -//// // Don't need to add anything in this case. -//// abstract class B extends A {} -//// -//// class C extends A {[| |]} +//// abstract get g(): string; +//// abstract set g(newName: string); +////} +//// +////// Don't need to add anything in this case. +////abstract class B extends A {} +//// +////class C extends A {[| |]} -verify.rangeAfterCodeFix(` - a: string | number; - b: this; - c: A; - d: string | number; - e: this; - f: A; - g: string; -`); +verify.codeFix({ + description: "Implement inherited abstract class.", + // TODO: GH#18795 + newRangeContent: `a: string | number;\r +b: this;\r +c: A;\r +d: string | number;\r +e: this;\r +f: A;\r +g: string;\r + ` +}); diff --git a/tests/cases/fourslash/codeFixClassExtendAbstractMethod.ts b/tests/cases/fourslash/codeFixClassExtendAbstractMethod.ts index 7e51e2216dc77..de9500552ab4c 100644 --- a/tests/cases/fourslash/codeFixClassExtendAbstractMethod.ts +++ b/tests/cases/fourslash/codeFixClassExtendAbstractMethod.ts @@ -1,24 +1,27 @@ /// -//// abstract class A { +////abstract class A { //// abstract f(a: number, b: string): boolean; //// abstract f(a: number, b: string): this; //// abstract f(a: string, b: number): Function; //// abstract f(a: string): Function; //// abstract foo(): number; -//// } +////} //// -//// class C extends A {[| |]} +////class C extends A {[| |]} -verify.rangeAfterCodeFix(` - f(a: number, b: string): boolean; - f(a: number, b: string): this; - f(a: string, b: number): Function; - f(a: string): Function; - f(a: any, b?: any) { - throw new Error("Method not implemented."); - } - foo(): number { - throw new Error("Method not implemented."); - } -`); +verify.codeFix({ + description: "Implement inherited abstract class.", + // TODO: GH#18795 + newRangeContent: `f(a: number, b: string): boolean;\r +f(a: number, b: string): this;\r +f(a: string, b: number): Function;\r +f(a: string): Function;\r +f(a: any, b?: any) {\r + throw new Error("Method not implemented.");\r +}\r +foo(): number {\r + throw new Error("Method not implemented.");\r +}\r + ` +}); diff --git a/tests/cases/fourslash/codeFixClassExtendAbstractMethodThis.ts b/tests/cases/fourslash/codeFixClassExtendAbstractMethodThis.ts index a462ac98121cd..e33338b45a99d 100644 --- a/tests/cases/fourslash/codeFixClassExtendAbstractMethodThis.ts +++ b/tests/cases/fourslash/codeFixClassExtendAbstractMethodThis.ts @@ -1,13 +1,16 @@ /// -//// abstract class A { +////abstract class A { //// abstract f(): this; -//// } +////} //// -//// class C extends A {[| |]} +////class C extends A {[| |]} -verify.rangeAfterCodeFix(` - f(): this { - throw new Error("Method not implemented."); - } -`); +verify.codeFix({ + description: "Implement inherited abstract class.", + // TODO: GH#18795 + newRangeContent: `f(): this {\r + throw new Error("Method not implemented.");\r +}\r + ` +}); diff --git a/tests/cases/fourslash/codeFixClassExtendAbstractMethodTypeParamsInstantiateNumber.ts b/tests/cases/fourslash/codeFixClassExtendAbstractMethodTypeParamsInstantiateNumber.ts index c1a55e8803464..395d9348b7928 100644 --- a/tests/cases/fourslash/codeFixClassExtendAbstractMethodTypeParamsInstantiateNumber.ts +++ b/tests/cases/fourslash/codeFixClassExtendAbstractMethodTypeParamsInstantiateNumber.ts @@ -1,12 +1,16 @@ /// -//// abstract class A { +////abstract class A { //// abstract f(x: T): T; -//// } +////} //// -//// class C extends A {[| |]} +////class C extends A {[| |]} -verify.rangeAfterCodeFix(`f(x: number): number{ - throw new Error("Method not implemented."); -} -`); \ No newline at end of file +verify.codeFix({ + description: "Implement inherited abstract class.", + // TODO: GH#18795 + newRangeContent: `f(x: number): number {\r + throw new Error("Method not implemented.");\r +}\r + ` +}); diff --git a/tests/cases/fourslash/codeFixClassExtendAbstractMethodTypeParamsInstantiateU.ts b/tests/cases/fourslash/codeFixClassExtendAbstractMethodTypeParamsInstantiateU.ts index c2ec5ff8035fb..408406a9efe8f 100644 --- a/tests/cases/fourslash/codeFixClassExtendAbstractMethodTypeParamsInstantiateU.ts +++ b/tests/cases/fourslash/codeFixClassExtendAbstractMethodTypeParamsInstantiateU.ts @@ -1,12 +1,16 @@ /// -//// abstract class A { +////abstract class A { //// abstract f(x: T): T; -//// } +////} //// -//// class C extends A {[| |]} +////class C extends A {[| |]} -verify.rangeAfterCodeFix(`f(x: U): U{ - throw new Error("Method not implemented."); -} -`); \ No newline at end of file +verify.codeFix({ + description: "Implement inherited abstract class.", + // TODO: GH#18795 + newRangeContent: `f(x: U): U {\r + throw new Error("Method not implemented.");\r +}\r + ` +}); diff --git a/tests/cases/fourslash/codeFixClassExtendAbstractProperty.ts b/tests/cases/fourslash/codeFixClassExtendAbstractProperty.ts index 701903d67706f..fbdb13f4f2c91 100644 --- a/tests/cases/fourslash/codeFixClassExtendAbstractProperty.ts +++ b/tests/cases/fourslash/codeFixClassExtendAbstractProperty.ts @@ -1,15 +1,18 @@ /// -//// abstract class A { +////abstract class A { //// abstract x: number; //// abstract y: this; //// abstract z: A; -//// } +////} //// -//// class C extends A {[| |]} +////class C extends A {[| |]} -verify.rangeAfterCodeFix(` - x: number; - y: this; - z: A; -`); +verify.codeFix({ + description: "Implement inherited abstract class.", + // TODO: GH#18795 + newRangeContent: `x: number;\r +y: this;\r +z: A;\r + ` +}); diff --git a/tests/cases/fourslash/unusedMethodInClass1.ts b/tests/cases/fourslash/unusedMethodInClass1.ts index a5e3789c8af7f..175d95e249021 100644 --- a/tests/cases/fourslash/unusedMethodInClass1.ts +++ b/tests/cases/fourslash/unusedMethodInClass1.ts @@ -1,11 +1,12 @@ /// // @noUnusedLocals: true -////[| class greeter { +////class greeter { //// private function1() { //// } -////} |] +////} -verify.rangeAfterCodeFix(` -class greeter { -}`); +verify.codeFix({ + description: `Remove declaration for: 'function1'.`, + newFileContent: "class greeter {\n}", +}); diff --git a/tests/cases/fourslash/unusedMethodInClass2.ts b/tests/cases/fourslash/unusedMethodInClass2.ts index cce621236d4df..884f7ecce4e83 100644 --- a/tests/cases/fourslash/unusedMethodInClass2.ts +++ b/tests/cases/fourslash/unusedMethodInClass2.ts @@ -1,15 +1,17 @@ /// // @noUnusedLocals: true -//// [| class greeter { +////class greeter { //// public function2() { //// } //// private function1() { //// } -////} |] +////} -verify.rangeAfterCodeFix(` -class greeter { +verify.codeFix({ + description: `Remove declaration for: 'function1'.`, + newFileContent: `class greeter { public function2() { } -}`); +}`, +}); diff --git a/tests/cases/fourslash/unusedMethodInClass3.ts b/tests/cases/fourslash/unusedMethodInClass3.ts index ccf98c4bbc52b..f76a1acde0924 100644 --- a/tests/cases/fourslash/unusedMethodInClass3.ts +++ b/tests/cases/fourslash/unusedMethodInClass3.ts @@ -1,11 +1,12 @@ /// // @noUnusedLocals: true -////[|class greeter { +////class greeter { //// private function1 = function() { //// } -////} |] +////} -verify.rangeAfterCodeFix(` -class greeter { -}`); +verify.codeFix({ + description: `Remove declaration for: 'function1'.`, + newFileContent: "class greeter {\n}", +}); diff --git a/tests/cases/fourslash/unusedMethodInClass4.ts b/tests/cases/fourslash/unusedMethodInClass4.ts index 962b80f5bc142..9f882a3b76eea 100644 --- a/tests/cases/fourslash/unusedMethodInClass4.ts +++ b/tests/cases/fourslash/unusedMethodInClass4.ts @@ -8,5 +8,9 @@ //// } |] ////} -verify.rangeAfterCodeFix(`public function2(){ -}`); +verify.codeFix({ + description: `Remove declaration for: 'function1'.`, + newRangeContent: `public function2(){ + } +`, +}); diff --git a/tests/cases/fourslash/unusedMethodInClass5.ts b/tests/cases/fourslash/unusedMethodInClass5.ts index 806e619817f89..c53a31b5d36e3 100644 --- a/tests/cases/fourslash/unusedMethodInClass5.ts +++ b/tests/cases/fourslash/unusedMethodInClass5.ts @@ -1,8 +1,11 @@ /// // @noUnusedLocals: true -//// [|class C { -//// private ["string"] (){} -//// }|] +////class C { +//// private ["string"] (){} +////} -verify.rangeAfterCodeFix("class C { }"); \ No newline at end of file +verify.codeFix({ + description: `Remove declaration for: '"string"'.`, + newFileContent: "class C {\n}", +}); diff --git a/tests/cases/fourslash/unusedMethodInClass6.ts b/tests/cases/fourslash/unusedMethodInClass6.ts index d223b3d6857ec..eef00d1cdd03a 100644 --- a/tests/cases/fourslash/unusedMethodInClass6.ts +++ b/tests/cases/fourslash/unusedMethodInClass6.ts @@ -1,8 +1,11 @@ /// // @noUnusedLocals: true -//// [|class C { -//// private "string" (){} -//// }|] +////class C { +//// private "string" (){} +////} -verify.rangeAfterCodeFix("class C { }"); \ No newline at end of file +verify.codeFix({ + description: `Remove declaration for: '"string"'.`, + newFileContent: "class C {\n}", +}); diff --git a/tests/cases/fourslash/unusedNamespaceInNamespace.ts b/tests/cases/fourslash/unusedNamespaceInNamespace.ts index 802336454c6f8..4391a6a158c43 100644 --- a/tests/cases/fourslash/unusedNamespaceInNamespace.ts +++ b/tests/cases/fourslash/unusedNamespaceInNamespace.ts @@ -1,13 +1,13 @@ /// // @noUnusedLocals: true -//// [|namespace A { +////namespace A { //// namespace B { -//// } -//// }|] - -verify.rangeAfterCodeFix(` -namespace A { -} -`); +//// } +////} +verify.codeFix({ + description: "Remove declaration for: 'B'.", + newFileContent: `namespace A { +}`, +}); diff --git a/tests/cases/fourslash/unusedParameterInConstructor1.ts b/tests/cases/fourslash/unusedParameterInConstructor1.ts index 33fe34c7e613c..46a8c1f3b5244 100644 --- a/tests/cases/fourslash/unusedParameterInConstructor1.ts +++ b/tests/cases/fourslash/unusedParameterInConstructor1.ts @@ -5,4 +5,8 @@ //// [|constructor(private p1: string, public p2: boolean, public p3: any, p5)|] { p5; } //// } -verify.rangeAfterCodeFix("constructor(public p2: boolean, public p3: any, p5)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0); \ No newline at end of file +verify.codeFix({ + description: "Remove declaration for: 'p1'.", + index: 0, + newRangeContent: "constructor(public p2: boolean, public p3: any, p5)", +}); diff --git a/tests/cases/fourslash/unusedParameterInConstructor1AddUnderscore.ts b/tests/cases/fourslash/unusedParameterInConstructor1AddUnderscore.ts index 31882978951ac..634561a5c65f5 100644 --- a/tests/cases/fourslash/unusedParameterInConstructor1AddUnderscore.ts +++ b/tests/cases/fourslash/unusedParameterInConstructor1AddUnderscore.ts @@ -5,4 +5,8 @@ //// [|constructor(private p1: string, public p2: boolean, public p3: any, p5) |] { p5; } //// } -verify.rangeAfterCodeFix("constructor(private _p1: string, public p2: boolean, public p3: any, p5)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 1); \ No newline at end of file +verify.codeFix({ + description: "Prefix 'p1' with an underscore.", + index: 1, + newRangeContent: "constructor(private _p1: string, public p2: boolean, public p3: any, p5)", +}); diff --git a/tests/cases/fourslash/unusedParameterInConstructor2.ts b/tests/cases/fourslash/unusedParameterInConstructor2.ts index 71595a9c81cbb..b8208bb535958 100644 --- a/tests/cases/fourslash/unusedParameterInConstructor2.ts +++ b/tests/cases/fourslash/unusedParameterInConstructor2.ts @@ -5,4 +5,8 @@ //// [|constructor(public p1: string, private p2: boolean, public p3: any, p5)|] { p5; } //// } -verify.rangeAfterCodeFix("constructor(public p1: string, public p3: any, p5)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0); \ No newline at end of file +verify.codeFix({ + description: "Remove declaration for: 'p2'.", + index: 0, + newRangeContent: "constructor(public p1: string, public p3: any, p5)", +}); diff --git a/tests/cases/fourslash/unusedParameterInConstructor3.ts b/tests/cases/fourslash/unusedParameterInConstructor3.ts index 3da0e85407f92..c36f24595a777 100644 --- a/tests/cases/fourslash/unusedParameterInConstructor3.ts +++ b/tests/cases/fourslash/unusedParameterInConstructor3.ts @@ -5,4 +5,8 @@ //// [|constructor(public p1: string, public p2: boolean, private p3: any, p5)|] { p5; } //// } -verify.rangeAfterCodeFix("constructor(public p1: string, public p2: boolean, p5)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0); \ No newline at end of file +verify.codeFix({ + description: "Remove declaration for: 'p3'.", + index: 0, + newRangeContent: "constructor(public p1: string, public p2: boolean, p5)", +}); diff --git a/tests/cases/fourslash/unusedParameterInConstructor4.ts b/tests/cases/fourslash/unusedParameterInConstructor4.ts index 860a7befa9b6f..99e98d64cdac5 100644 --- a/tests/cases/fourslash/unusedParameterInConstructor4.ts +++ b/tests/cases/fourslash/unusedParameterInConstructor4.ts @@ -5,4 +5,8 @@ //// [|constructor(private readonly p2: boolean, p5)|] { p5; } //// } -verify.rangeAfterCodeFix("constructor(p5)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0); \ No newline at end of file +verify.codeFix({ + description: "Remove declaration for: 'p2'.", + index: 0, + newRangeContent: "constructor(p5)", +}); diff --git a/tests/cases/fourslash/unusedParameterInFunction1.ts b/tests/cases/fourslash/unusedParameterInFunction1.ts index bc6f081ecaa59..3f979f787668f 100644 --- a/tests/cases/fourslash/unusedParameterInFunction1.ts +++ b/tests/cases/fourslash/unusedParameterInFunction1.ts @@ -4,4 +4,8 @@ ////function [|greeter( x)|] { ////} -verify.rangeAfterCodeFix("greeter()", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0); +verify.codeFix({ + description: "Remove declaration for: 'x'.", + index: 0, + newRangeContent: "greeter()", +}); diff --git a/tests/cases/fourslash/unusedParameterInFunction1AddUnderscore.ts b/tests/cases/fourslash/unusedParameterInFunction1AddUnderscore.ts index 137625869c8bc..c248c5e1a94cc 100644 --- a/tests/cases/fourslash/unusedParameterInFunction1AddUnderscore.ts +++ b/tests/cases/fourslash/unusedParameterInFunction1AddUnderscore.ts @@ -4,4 +4,8 @@ ////function [|greeter( x) |] { ////} -verify.rangeAfterCodeFix("greeter( _x)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 1); +verify.codeFix({ + description: "Prefix 'x' with an underscore.", + index: 1, + newRangeContent: "greeter( _x)", +}); diff --git a/tests/cases/fourslash/unusedParameterInFunction2.ts b/tests/cases/fourslash/unusedParameterInFunction2.ts index 6d1a772b0a81d..74d95c9922177 100644 --- a/tests/cases/fourslash/unusedParameterInFunction2.ts +++ b/tests/cases/fourslash/unusedParameterInFunction2.ts @@ -5,4 +5,8 @@ //// use(x); ////} -verify.rangeAfterCodeFix("greeter(x)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0); \ No newline at end of file +verify.codeFix({ + description: "Remove declaration for: 'y'.", + index: 0, + newRangeContent: "greeter(x)", +}); diff --git a/tests/cases/fourslash/unusedParameterInFunction3.ts b/tests/cases/fourslash/unusedParameterInFunction3.ts index dcbe53163db59..30dc2a940609b 100644 --- a/tests/cases/fourslash/unusedParameterInFunction3.ts +++ b/tests/cases/fourslash/unusedParameterInFunction3.ts @@ -5,4 +5,8 @@ //// y++; ////} -verify.rangeAfterCodeFix("greeter(y)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0); \ No newline at end of file +verify.codeFix({ + description: "Remove declaration for: 'x'.", + index: 0, + newRangeContent: "greeter(y)", +}); diff --git a/tests/cases/fourslash/unusedParameterInFunction4.ts b/tests/cases/fourslash/unusedParameterInFunction4.ts index e3ee25853840c..87b5880ba70f4 100644 --- a/tests/cases/fourslash/unusedParameterInFunction4.ts +++ b/tests/cases/fourslash/unusedParameterInFunction4.ts @@ -5,4 +5,8 @@ //// use(x, z); ////} -verify.rangeAfterCodeFix("function greeter(x,z)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0); \ No newline at end of file +verify.codeFix({ + description: "Remove declaration for: 'y'.", + index: 0, + newRangeContent: "function greeter(x,z) ", +}); diff --git a/tests/cases/fourslash/unusedParameterInLambda1.ts b/tests/cases/fourslash/unusedParameterInLambda1.ts index a5f735c701654..325502ebb6d9e 100644 --- a/tests/cases/fourslash/unusedParameterInLambda1.ts +++ b/tests/cases/fourslash/unusedParameterInLambda1.ts @@ -6,4 +6,8 @@ //// [|return (x:number) => {}|] //// } -verify.rangeAfterCodeFix("return () => {}", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0); +verify.codeFix({ + description: "Remove declaration for: 'x'.", + index: 0, + newRangeContent: "return () => {}", +}); diff --git a/tests/cases/fourslash/unusedParameterInLambda1AddUnderscore.ts b/tests/cases/fourslash/unusedParameterInLambda1AddUnderscore.ts index 916c32d82ebf2..1b05c66dd2fb5 100644 --- a/tests/cases/fourslash/unusedParameterInLambda1AddUnderscore.ts +++ b/tests/cases/fourslash/unusedParameterInLambda1AddUnderscore.ts @@ -6,4 +6,8 @@ //// [|return (x:number) => {} |] //// } -verify.rangeAfterCodeFix("return (_x:number) => {}", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 1); +verify.codeFix({ + description: "Prefix 'x' with an underscore.", + index: 1, + newRangeContent: "return (_x:number) => {}", +}); diff --git a/tests/cases/fourslash/unusedTypeAliasInNamespace1.ts b/tests/cases/fourslash/unusedTypeAliasInNamespace1.ts index 2314ebbe447e9..13c87f6afd6a1 100644 --- a/tests/cases/fourslash/unusedTypeAliasInNamespace1.ts +++ b/tests/cases/fourslash/unusedTypeAliasInNamespace1.ts @@ -1,11 +1,14 @@ /// // @noUnusedLocals: true -//// [| namespace greeter { -//// type hw = "Hello" |"world"; -//// export type nw = "No" | "Way"; -//// } |] +////namespace greeter { +//// type hw = "Hello" |"world"; +//// export type nw = "No" | "Way"; +////} -verify.rangeAfterCodeFix(`namespace greeter { +verify.codeFix({ + description: "Remove declaration for: 'hw'.", + newFileContent: `namespace greeter { export type nw = "No" | "Way"; -}`); +}`, +}); diff --git a/tests/cases/fourslash/unusedTypeParametersInClass1.ts b/tests/cases/fourslash/unusedTypeParametersInClass1.ts index 322921ab47133..6574362511f4a 100644 --- a/tests/cases/fourslash/unusedTypeParametersInClass1.ts +++ b/tests/cases/fourslash/unusedTypeParametersInClass1.ts @@ -4,4 +4,7 @@ ////[|class greeter |] { ////} -verify.rangeAfterCodeFix("class greeter"); \ No newline at end of file +verify.codeFix({ + description: "Remove declaration for: 'T'.", + newRangeContent: "class greeter ", +}); diff --git a/tests/cases/fourslash/unusedTypeParametersInClass2.ts b/tests/cases/fourslash/unusedTypeParametersInClass2.ts index feaf9d3a14b77..3cb984a11ecb8 100644 --- a/tests/cases/fourslash/unusedTypeParametersInClass2.ts +++ b/tests/cases/fourslash/unusedTypeParametersInClass2.ts @@ -5,4 +5,7 @@ //// public a: X; ////} -verify.rangeAfterCodeFix("class greeter"); \ No newline at end of file +verify.codeFix({ + description: "Remove declaration for: 'Y'.", + newRangeContent: "class greeter ", +}); diff --git a/tests/cases/fourslash/unusedTypeParametersInClass3.ts b/tests/cases/fourslash/unusedTypeParametersInClass3.ts index b1151265fe351..13ebc352cb00c 100644 --- a/tests/cases/fourslash/unusedTypeParametersInClass3.ts +++ b/tests/cases/fourslash/unusedTypeParametersInClass3.ts @@ -6,4 +6,7 @@ //// public b: Z; ////} -verify.rangeAfterCodeFix("class greeter"); +verify.codeFix({ + description: "Remove declaration for: 'Y'.", + newRangeContent: "class greeter ", +}); diff --git a/tests/cases/fourslash/unusedTypeParametersInFunction1.ts b/tests/cases/fourslash/unusedTypeParametersInFunction1.ts index a11156badaaa9..b7289fc1e0a10 100644 --- a/tests/cases/fourslash/unusedTypeParametersInFunction1.ts +++ b/tests/cases/fourslash/unusedTypeParametersInFunction1.ts @@ -3,4 +3,7 @@ // @noUnusedLocals: true //// [|function f1() {}|] -verify.rangeAfterCodeFix("function f1() {}"); +verify.codeFix({ + description: "Remove declaration for: 'T'.", + newRangeContent: "function f1() {}", +}); diff --git a/tests/cases/fourslash/unusedTypeParametersInFunction2.ts b/tests/cases/fourslash/unusedTypeParametersInFunction2.ts index a011f093dab32..e2851b346054a 100644 --- a/tests/cases/fourslash/unusedTypeParametersInFunction2.ts +++ b/tests/cases/fourslash/unusedTypeParametersInFunction2.ts @@ -3,4 +3,7 @@ // @noUnusedLocals: true //// [|function f1(a: X) {a}|] -verify.rangeAfterCodeFix("function f1(a: X) {a}"); +verify.codeFix({ + description: "Remove declaration for: 'Y'.", + newRangeContent: "function f1(a: X) {a}", +}); diff --git a/tests/cases/fourslash/unusedTypeParametersInFunction3.ts b/tests/cases/fourslash/unusedTypeParametersInFunction3.ts index 6dc56ccc7cbfd..4be2dc5feb336 100644 --- a/tests/cases/fourslash/unusedTypeParametersInFunction3.ts +++ b/tests/cases/fourslash/unusedTypeParametersInFunction3.ts @@ -3,4 +3,7 @@ // @noUnusedLocals: true //// [|function f1(a: X) {a;var b:Z;b}|] -verify.rangeAfterCodeFix("function f1(a: X) {a;var b:Z;b}"); +verify.codeFix({ + description: "Remove declaration for: 'Y'.", + newRangeContent: "function f1(a: X) {a;var b:Z;b}", +}); diff --git a/tests/cases/fourslash/unusedTypeParametersInInterface1.ts b/tests/cases/fourslash/unusedTypeParametersInInterface1.ts index b5363b369be70..bc3a95d63b6a8 100644 --- a/tests/cases/fourslash/unusedTypeParametersInInterface1.ts +++ b/tests/cases/fourslash/unusedTypeParametersInInterface1.ts @@ -4,4 +4,7 @@ // @noUnusedParameters: true //// [|interface I {}|] -verify.rangeAfterCodeFix("interface I {}"); \ No newline at end of file +verify.codeFix({ + description: "Remove declaration for: 'T'.", + newRangeContent: "interface I {}", +}); diff --git a/tests/cases/fourslash/unusedTypeParametersInLambda1.ts b/tests/cases/fourslash/unusedTypeParametersInLambda1.ts index 01c1ebd24f52d..3d7310d6ae6f8 100644 --- a/tests/cases/fourslash/unusedTypeParametersInLambda1.ts +++ b/tests/cases/fourslash/unusedTypeParametersInLambda1.ts @@ -6,4 +6,7 @@ //// [|return (x:number) => {x}|] //// } -verify.rangeAfterCodeFix("return (x:number) => {x}"); +verify.codeFix({ + description: "Remove declaration for: 'T'.", + newRangeContent: "return(x:number) => {x}", +}); diff --git a/tests/cases/fourslash/unusedTypeParametersInLambda2.ts b/tests/cases/fourslash/unusedTypeParametersInLambda2.ts index e5a4acc31c53e..b2b89d3373ea4 100644 --- a/tests/cases/fourslash/unusedTypeParametersInLambda2.ts +++ b/tests/cases/fourslash/unusedTypeParametersInLambda2.ts @@ -6,4 +6,7 @@ //// [|new (a: T): void;|] //// } -verify.rangeAfterCodeFix("new (a: T): void;"); +verify.codeFix({ + description: "Remove declaration for: 'U'.", + newRangeContent: "new (a: T): void;", +}); diff --git a/tests/cases/fourslash/unusedTypeParametersInLambda3.ts b/tests/cases/fourslash/unusedTypeParametersInLambda3.ts index e6d866dcb6aaa..1f994c4590598 100644 --- a/tests/cases/fourslash/unusedTypeParametersInLambda3.ts +++ b/tests/cases/fourslash/unusedTypeParametersInLambda3.ts @@ -7,4 +7,7 @@ //// [|new (a: T): A;|] //// } -verify.rangeAfterCodeFix("new (a: T): A;"); +verify.codeFix({ + description: "Remove declaration for: 'K'.", + newRangeContent: "new (a: T): A;", +}); diff --git a/tests/cases/fourslash/unusedTypeParametersInLambda4.ts b/tests/cases/fourslash/unusedTypeParametersInLambda4.ts index 04bd7c7e9becf..d5c01202d261f 100644 --- a/tests/cases/fourslash/unusedTypeParametersInLambda4.ts +++ b/tests/cases/fourslash/unusedTypeParametersInLambda4.ts @@ -6,4 +6,7 @@ //// } //// [|var y: new (a:T)=>void;|] -verify.rangeAfterCodeFix("var y: new (a:T)=>void;"); \ No newline at end of file +verify.codeFix({ + description: "Remove declaration for: 'U'.", + newRangeContent: "var y: new (a:T)=>void;", +}); diff --git a/tests/cases/fourslash/unusedTypeParametersInMethod1.ts b/tests/cases/fourslash/unusedTypeParametersInMethod1.ts index bc14952eca9b7..f4d036f54f493 100644 --- a/tests/cases/fourslash/unusedTypeParametersInMethod1.ts +++ b/tests/cases/fourslash/unusedTypeParametersInMethod1.ts @@ -5,4 +5,7 @@ //// [|f1()|] {} //// } -verify.rangeAfterCodeFix("f1()"); \ No newline at end of file +verify.codeFix({ + description: "Remove declaration for: 'T'.", + newRangeContent: "f1()", +}); diff --git a/tests/cases/fourslash/unusedTypeParametersInMethod2.ts b/tests/cases/fourslash/unusedTypeParametersInMethod2.ts index c12fd53f66b0b..25556ebc57dfa 100644 --- a/tests/cases/fourslash/unusedTypeParametersInMethod2.ts +++ b/tests/cases/fourslash/unusedTypeParametersInMethod2.ts @@ -5,4 +5,7 @@ //// [|f1(a: U)|] {a;} //// } -verify.rangeAfterCodeFix("f1(a: U)"); \ No newline at end of file +verify.codeFix({ + description: "Remove declaration for: 'T'.", + newRangeContent: "f1(a: U)", +}); diff --git a/tests/cases/fourslash/unusedTypeParametersInMethods1.ts b/tests/cases/fourslash/unusedTypeParametersInMethods1.ts index d0b170491f5e1..62f222464311e 100644 --- a/tests/cases/fourslash/unusedTypeParametersInMethods1.ts +++ b/tests/cases/fourslash/unusedTypeParametersInMethods1.ts @@ -5,4 +5,7 @@ //// [|public f1(a: X)|] { a; var b: Z; b } //// } -verify.rangeAfterCodeFix("public f1(a: X)"); +verify.codeFix({ + description: "Remove declaration for: 'Y'.", + newRangeContent: "public f1(a: X)", +}); diff --git a/tests/cases/fourslash/unusedVariableInBlocks.ts b/tests/cases/fourslash/unusedVariableInBlocks.ts index 2a33d0c4cf5c6..fe3c002916b43 100644 --- a/tests/cases/fourslash/unusedVariableInBlocks.ts +++ b/tests/cases/fourslash/unusedVariableInBlocks.ts @@ -1,15 +1,18 @@ /// // @noUnusedLocals: true -//// function f1 () { +////function f1 () { //// [|let x = 10; //// { //// let x = 11; //// } //// x;|] -//// } +////} -verify.rangeAfterCodeFix(`let x = 10; - { - } - x;`); +verify.codeFix({ + description: "Remove declaration for: 'x'.", + newRangeContent: `let x = 10; + { + } + x;`, +}); diff --git a/tests/cases/fourslash/unusedVariableInClass1.ts b/tests/cases/fourslash/unusedVariableInClass1.ts index 8b0ca0db727db..e4cec171e8eda 100644 --- a/tests/cases/fourslash/unusedVariableInClass1.ts +++ b/tests/cases/fourslash/unusedVariableInClass1.ts @@ -5,4 +5,7 @@ //// [|private greeting: string;|] ////} -verify.rangeAfterCodeFix(""); +verify.codeFix({ + description: "Remove declaration for: 'greeting'.", + newRangeContent: "", +}); diff --git a/tests/cases/fourslash/unusedVariableInClass2.ts b/tests/cases/fourslash/unusedVariableInClass2.ts index 6503dd02872fe..1f632a43ce83b 100644 --- a/tests/cases/fourslash/unusedVariableInClass2.ts +++ b/tests/cases/fourslash/unusedVariableInClass2.ts @@ -6,4 +6,7 @@ //// private greeting: string;|] ////} -verify.rangeAfterCodeFix("public greeting1;"); +verify.codeFix({ + description: "Remove declaration for: 'greeting'.", + newRangeContent: "public greeting1;\n", +}); diff --git a/tests/cases/fourslash/unusedVariableInClass3.ts b/tests/cases/fourslash/unusedVariableInClass3.ts index 3ac306170a203..eec4e6bbe8fa9 100644 --- a/tests/cases/fourslash/unusedVariableInClass3.ts +++ b/tests/cases/fourslash/unusedVariableInClass3.ts @@ -5,4 +5,7 @@ //// private X = function() {}; ////|]} -verify.rangeAfterCodeFix(""); +verify.codeFix({ + description: "Remove declaration for: 'X'.", + newRangeContent: "\n", +}); diff --git a/tests/cases/fourslash/unusedVariableInForLoop1FS.ts b/tests/cases/fourslash/unusedVariableInForLoop1FS.ts index 760d8487b3438..2a4feffd47450 100644 --- a/tests/cases/fourslash/unusedVariableInForLoop1FS.ts +++ b/tests/cases/fourslash/unusedVariableInForLoop1FS.ts @@ -7,5 +7,7 @@ //// } //// } -verify.rangeAfterCodeFix("for(; ;)"); - +verify.codeFix({ + description: "Remove declaration for: 'i'.", + newRangeContent: "for(; ;) ", +}); diff --git a/tests/cases/fourslash/unusedVariableInForLoop2FS.ts b/tests/cases/fourslash/unusedVariableInForLoop2FS.ts index a16f21e8417a4..d913ae5ce94b2 100644 --- a/tests/cases/fourslash/unusedVariableInForLoop2FS.ts +++ b/tests/cases/fourslash/unusedVariableInForLoop2FS.ts @@ -7,4 +7,7 @@ //// } //// } -verify.rangeAfterCodeFix("for(var i = 0; ;i++)"); +verify.codeFix({ + description: "Remove declaration for: 'j'.", + newRangeContent: "for(var i = 0; ;i++)", +}); diff --git a/tests/cases/fourslash/unusedVariableInForLoop3FS.ts b/tests/cases/fourslash/unusedVariableInForLoop3FS.ts index 07d13307ca794..6f3beae5c74d7 100644 --- a/tests/cases/fourslash/unusedVariableInForLoop3FS.ts +++ b/tests/cases/fourslash/unusedVariableInForLoop3FS.ts @@ -7,4 +7,7 @@ //// } //// } -verify.rangeAfterCodeFix("for(var i = 0, k=0; ;i++,k++)"); \ No newline at end of file +verify.codeFix({ + description: "Remove declaration for: 'j'.", + newRangeContent: "for(var i = 0, k=0; ;i++, k++)", +}); diff --git a/tests/cases/fourslash/unusedVariableInForLoop4FS.ts b/tests/cases/fourslash/unusedVariableInForLoop4FS.ts index d54f8baaa3d5c..661012958d4f0 100644 --- a/tests/cases/fourslash/unusedVariableInForLoop4FS.ts +++ b/tests/cases/fourslash/unusedVariableInForLoop4FS.ts @@ -7,4 +7,7 @@ //// } //// } -verify.rangeAfterCodeFix("for(var j = 0, k=0; ;j++,k++)"); +verify.codeFix({ + description: "Remove declaration for: 'i'.", + newRangeContent: "for(var j= 0, k=0; ;j++, k++) ", +}); diff --git a/tests/cases/fourslash/unusedVariableInForLoop5FSAddUnderscore.ts b/tests/cases/fourslash/unusedVariableInForLoop5FSAddUnderscore.ts index 2948bfab2075f..87783ff67fc0b 100644 --- a/tests/cases/fourslash/unusedVariableInForLoop5FSAddUnderscore.ts +++ b/tests/cases/fourslash/unusedVariableInForLoop5FSAddUnderscore.ts @@ -7,4 +7,7 @@ //// } //// } -verify.rangeAfterCodeFix(`for (const _elem in ["a", "b", "c"])`, /*includeWhiteSpace*/ true, /*errorCode*/ 0); +verify.codeFix({ + description: "Prefix 'elem' with an underscore.", + newRangeContent: 'for (const _elem in ["a", "b", "c"])' +}); diff --git a/tests/cases/fourslash/unusedVariableInForLoop6FS.ts b/tests/cases/fourslash/unusedVariableInForLoop6FS.ts index fa1948438bc09..9661514d43199 100644 --- a/tests/cases/fourslash/unusedVariableInForLoop6FS.ts +++ b/tests/cases/fourslash/unusedVariableInForLoop6FS.ts @@ -7,5 +7,8 @@ //// } //// } -verify.rangeAfterCodeFix("const {} of ", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0); - +verify.codeFix({ + description: "Remove declaration for: 'elem'.", + index: 0, + newRangeContent: "const {} of", +}); diff --git a/tests/cases/fourslash/unusedVariableInForLoop6FSAddUnderscore.ts b/tests/cases/fourslash/unusedVariableInForLoop6FSAddUnderscore.ts index 4faa6893b7fa5..9f8c7b19f99d8 100644 --- a/tests/cases/fourslash/unusedVariableInForLoop6FSAddUnderscore.ts +++ b/tests/cases/fourslash/unusedVariableInForLoop6FSAddUnderscore.ts @@ -7,5 +7,9 @@ //// } //// } -verify.rangeAfterCodeFix("const _elem of", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 1); +verify.codeFix({ + description: "Prefix 'elem' with an underscore.", + index: 1, + newRangeContent: "const _elem of" +}); diff --git a/tests/cases/fourslash/unusedVariableInForLoop7FS.ts b/tests/cases/fourslash/unusedVariableInForLoop7FS.ts index 7f99863ba46ee..c42bf8bc97a28 100644 --- a/tests/cases/fourslash/unusedVariableInForLoop7FS.ts +++ b/tests/cases/fourslash/unusedVariableInForLoop7FS.ts @@ -9,8 +9,11 @@ ////}|] //// -verify.rangeAfterCodeFix(`{ +verify.codeFix({ + description: "Remove declaration for: 'x'.", + newRangeContent: `{ for (const elem of ["a", "b", "c"]) { elem; } -}`, /*includeWhiteSpace*/ true); +}` +}); diff --git a/tests/cases/fourslash/unusedVariableInModule1.ts b/tests/cases/fourslash/unusedVariableInModule1.ts index e9fe9515e6d8d..7a0a3ad86016a 100644 --- a/tests/cases/fourslash/unusedVariableInModule1.ts +++ b/tests/cases/fourslash/unusedVariableInModule1.ts @@ -6,4 +6,7 @@ //// [|var x: string; //// export var y: string;|] -verify.rangeAfterCodeFix("export var y: string;"); +verify.codeFix({ + description: "Remove declaration for: 'x'.", + newRangeContent: "export var y: string;", +}); diff --git a/tests/cases/fourslash/unusedVariableInModule2.ts b/tests/cases/fourslash/unusedVariableInModule2.ts index ac6e7120d8bd9..e8a1ae762d4ef 100644 --- a/tests/cases/fourslash/unusedVariableInModule2.ts +++ b/tests/cases/fourslash/unusedVariableInModule2.ts @@ -7,4 +7,7 @@ //// z; //// export var y: string; -verify.rangeAfterCodeFix("var z: number;"); +verify.codeFix({ + description: "Remove declaration for: 'x'.", + newRangeContent: "var z: number;", +}); diff --git a/tests/cases/fourslash/unusedVariableInModule3.ts b/tests/cases/fourslash/unusedVariableInModule3.ts index 0185b89e3a634..56b08f5499ef7 100644 --- a/tests/cases/fourslash/unusedVariableInModule3.ts +++ b/tests/cases/fourslash/unusedVariableInModule3.ts @@ -6,4 +6,7 @@ //// [|var x = function f1() {} //// export var y: string;|] -verify.rangeAfterCodeFix("export var y: string;"); +verify.codeFix({ + description: "Remove declaration for: 'x'.", + newRangeContent: "export var y: string;", +}); diff --git a/tests/cases/fourslash/unusedVariableInModule4.ts b/tests/cases/fourslash/unusedVariableInModule4.ts index 6d80d59c2ced2..71890893b9e7c 100644 --- a/tests/cases/fourslash/unusedVariableInModule4.ts +++ b/tests/cases/fourslash/unusedVariableInModule4.ts @@ -7,4 +7,8 @@ //// x; //// export var y: string; -verify.rangeAfterCodeFix(`var x = function f1() {}`, /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0); +verify.codeFix({ + description: "Remove declaration for: 'm'.", + index: 0, + newRangeContent: `var x = function f1() {}`, +}); diff --git a/tests/cases/fourslash/unusedVariableInNamespace1.ts b/tests/cases/fourslash/unusedVariableInNamespace1.ts index c9f38473a5151..6dd14233683c2 100644 --- a/tests/cases/fourslash/unusedVariableInNamespace1.ts +++ b/tests/cases/fourslash/unusedVariableInNamespace1.ts @@ -5,4 +5,7 @@ //// [|let a = "dummy entry";|] ////} -verify.rangeAfterCodeFix(""); +verify.codeFix({ + description: "Remove declaration for: 'a'.", + newRangeContent: "", +}); diff --git a/tests/cases/fourslash/unusedVariableInNamespace2.ts b/tests/cases/fourslash/unusedVariableInNamespace2.ts index 61fc3ec137c0b..9bf546f6f53d7 100644 --- a/tests/cases/fourslash/unusedVariableInNamespace2.ts +++ b/tests/cases/fourslash/unusedVariableInNamespace2.ts @@ -8,4 +8,7 @@ //// } ////} -verify.rangeAfterCodeFix(`let a = "dummy entry", c = 0;`); +verify.codeFix({ + description: "Remove declaration for: 'b'.", + newRangeContent: 'let a = "dummy entry", c = 0;', +}); diff --git a/tests/cases/fourslash/unusedVariableInNamespace3.ts b/tests/cases/fourslash/unusedVariableInNamespace3.ts index 7d2f3d251f397..85e1889c3e1af 100644 --- a/tests/cases/fourslash/unusedVariableInNamespace3.ts +++ b/tests/cases/fourslash/unusedVariableInNamespace3.ts @@ -8,4 +8,7 @@ //// } ////} -verify.rangeAfterCodeFix(`let a = "dummy entry", b;`); +verify.codeFix({ + description: "Remove declaration for: 'c'.", + newRangeContent: 'let a = "dummy entry", b;', +});