Merge pull request #16495 from aozgaa/codeFixPrefixUnused2-port2.4

port #16309 (prefix unused with _) to release-2.4
This commit is contained in:
Arthur Ozga
2017-06-13 17:10:36 -07:00
committed by GitHub
23 changed files with 132 additions and 77 deletions

View File

@@ -0,0 +1,11 @@
/// <reference path='fourslash.ts' />
// @noUnusedLocals: true
//// [| namespace greeter {
//// /* comment1 */
//// class /* comment2 */ class1 {
//// }
//// } |]
verify.rangeAfterCodeFix(`namespace greeter {
}`);

View File

@@ -7,4 +7,4 @@
//// z+1;
////}
verify.rangeAfterCodeFix("var x,z = 1;", /*includeWhiteSpace*/ undefined, 6133);
verify.rangeAfterCodeFix("var x,z = 1;", /*includeWhiteSpace*/ undefined, /*errorCode*/ 6133);

View File

@@ -5,4 +5,4 @@
//// [|constructor(private p1: string, public p2: boolean, public p3: any, p5)|] { p5; }
//// }
verify.rangeAfterCodeFix("constructor(public p2: boolean, public p3: any, p5)");
verify.rangeAfterCodeFix("constructor(public p2: boolean, public p3: any, p5)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);

View File

@@ -0,0 +1,8 @@
/// <reference path='fourslash.ts' />
// @noUnusedLocals: true
//// class C1 {
//// [|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);

View File

@@ -5,4 +5,4 @@
//// [|constructor(public p1: string, private p2: boolean, public p3: any, p5)|] { p5; }
//// }
verify.rangeAfterCodeFix("constructor(public p1: string, public p3: any, p5)");
verify.rangeAfterCodeFix("constructor(public p1: string, public p3: any, p5)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);

View File

@@ -5,4 +5,4 @@
//// [|constructor(public p1: string, public p2: boolean, private p3: any, p5)|] { p5; }
//// }
verify.rangeAfterCodeFix("constructor(public p1: string, public p2: boolean, p5)");
verify.rangeAfterCodeFix("constructor(public p1: string, public p2: boolean, p5)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);

View File

@@ -5,4 +5,4 @@
//// [|constructor(private readonly p2: boolean, p5)|] { p5; }
//// }
verify.rangeAfterCodeFix("constructor(p5)");
verify.rangeAfterCodeFix("constructor(p5)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);

View File

@@ -4,4 +4,4 @@
////function [|greeter( x)|] {
////}
verify.rangeAfterCodeFix("greeter()");
verify.rangeAfterCodeFix("greeter()", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);

View File

@@ -0,0 +1,7 @@
/// <reference path='fourslash.ts' />
// @noUnusedParameters: true
////function [|greeter( x) |] {
////}
verify.rangeAfterCodeFix("greeter( _x)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 1);

View File

@@ -5,4 +5,4 @@
//// x++;
////}
verify.rangeAfterCodeFix("greeter(x)");
verify.rangeAfterCodeFix("greeter(x)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);

View File

@@ -5,4 +5,4 @@
//// y++;
////}
verify.rangeAfterCodeFix("greeter(y)");
verify.rangeAfterCodeFix("greeter(y)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);

View File

@@ -6,4 +6,4 @@
//// z++;
////}
verify.rangeAfterCodeFix("function greeter(x,z)");
verify.rangeAfterCodeFix("function greeter(x,z)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);

View File

@@ -6,4 +6,4 @@
//// [|return (x:number) => {}|]
//// }
verify.rangeAfterCodeFix("return () => {}");
verify.rangeAfterCodeFix("return () => {}", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);

View File

@@ -0,0 +1,9 @@
/// <reference path='fourslash.ts' />
// @noUnusedLocals: true
// @noUnusedParameters: true
//// function f1() {
//// [|return (x:number) => {} |]
//// }
verify.rangeAfterCodeFix("return (_x:number) => {}", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 1);

View File

@@ -1,11 +0,0 @@
/// <reference path='fourslash.ts' />
// @noUnusedLocals: true
//// function f1 () {
//// for (const elem in ["a", "b", "c"]) {
////
//// }
//// }
verify.not.codeFixAvailable();

View File

@@ -0,0 +1,10 @@
/// <reference path='fourslash.ts' />
// @noUnusedLocals: true
//// function f1 () {
//// [|for (const elem in ["a", "b", "c"]) |]{
////
//// }
//// }
verify.rangeAfterCodeFix(`for (const _elem in ["a", "b", "c"])`, /*includeWhiteSpace*/ true, /*errorCode*/ 0);

View File

@@ -7,5 +7,5 @@
//// }
//// }
verify.rangeAfterCodeFix("const {} of ");
verify.rangeAfterCodeFix("const {} of ", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);

View File

@@ -0,0 +1,11 @@
/// <reference path='fourslash.ts' />
// @noUnusedLocals: true
//// function f1 () {
//// for ([|const elem of |]["a", "b", "c"]) {
////
//// }
//// }
verify.rangeAfterCodeFix("const _elem of", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 1);

View File

@@ -7,4 +7,4 @@
//// x;
//// export var y: string;
verify.rangeAfterCodeFix(`var x = function f1() {}`);
verify.rangeAfterCodeFix(`var x = function f1() {}`, /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);