TypeScript/tests/cases/fourslash/codeFixChangeExtendsToImplementsWithTrivia.ts
Andrew Casey afae97ce6e Refine extends-to-implements code fix
1. Retain surrounding trivia when swapping the keyword.
 2. Insert commas at the full-starts, rather than starts, of existing
 keywords when merging with existing implements clauses.

Fixes #18794
2018-01-04 17:55:12 -08:00

20 lines
554 B
TypeScript

/// <reference path='fourslash.ts' />
//// interface I1 { }
//// interface I2 { }
//// interface I3 { }
//// [|class MyClass /*A !*/ //B !
//// /*C !*/ extends /*D !*/ I1 /*E !*/ //F !
//// /*G !*/ implements /*H !*/ I2 /*I !*/, /*J !*/ I3 /*K !*/ //L !|]
//// {
//// }
verify.codeFix({
description: "Change 'extends' to 'implements'",
// TODO: GH#18794
newRangeContent: `class MyClass /*A !*/ //B !
/*C !*/ implements /*D !*/ I1, /*E !*/ //F !
/*G !*/ /*H !*/ I2 /*I !*/, /*J !*/ I3 /*K !*/ //L !`,
});