mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-15 12:53:27 -05:00
Merge pull request #16495 from aozgaa/codeFixPrefixUnused2-port2.4
port #16309 (prefix unused with _) to release-2.4
This commit is contained in:
11
tests/cases/fourslash/unusedClassInNamespaceWithTrivia.ts
Normal file
11
tests/cases/fourslash/unusedClassInNamespaceWithTrivia.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @noUnusedLocals: true
|
||||
//// [| namespace greeter {
|
||||
//// /* comment1 */
|
||||
//// class /* comment2 */ class1 {
|
||||
//// }
|
||||
//// } |]
|
||||
|
||||
verify.rangeAfterCodeFix(`namespace greeter {
|
||||
}`);
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -4,4 +4,4 @@
|
||||
////function [|greeter( x)|] {
|
||||
////}
|
||||
|
||||
verify.rangeAfterCodeFix("greeter()");
|
||||
verify.rangeAfterCodeFix("greeter()", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @noUnusedParameters: true
|
||||
////function [|greeter( x) |] {
|
||||
////}
|
||||
|
||||
verify.rangeAfterCodeFix("greeter( _x)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 1);
|
||||
@@ -5,4 +5,4 @@
|
||||
//// x++;
|
||||
////}
|
||||
|
||||
verify.rangeAfterCodeFix("greeter(x)");
|
||||
verify.rangeAfterCodeFix("greeter(x)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);
|
||||
@@ -5,4 +5,4 @@
|
||||
//// y++;
|
||||
////}
|
||||
|
||||
verify.rangeAfterCodeFix("greeter(y)");
|
||||
verify.rangeAfterCodeFix("greeter(y)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);
|
||||
@@ -6,4 +6,4 @@
|
||||
//// z++;
|
||||
////}
|
||||
|
||||
verify.rangeAfterCodeFix("function greeter(x,z)");
|
||||
verify.rangeAfterCodeFix("function greeter(x,z)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);
|
||||
@@ -6,4 +6,4 @@
|
||||
//// [|return (x:number) => {}|]
|
||||
//// }
|
||||
|
||||
verify.rangeAfterCodeFix("return () => {}");
|
||||
verify.rangeAfterCodeFix("return () => {}", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);
|
||||
|
||||
@@ -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);
|
||||
@@ -1,11 +0,0 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @noUnusedLocals: true
|
||||
//// function f1 () {
|
||||
//// for (const elem in ["a", "b", "c"]) {
|
||||
////
|
||||
//// }
|
||||
//// }
|
||||
|
||||
verify.not.codeFixAvailable();
|
||||
|
||||
@@ -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);
|
||||
@@ -7,5 +7,5 @@
|
||||
//// }
|
||||
//// }
|
||||
|
||||
verify.rangeAfterCodeFix("const {} of ");
|
||||
verify.rangeAfterCodeFix("const {} of ", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user