* add refactor of convert private field to getter and setter * fix refactor * stash * refactor accessor generate * revert merge union type * refeactor and accept baseline * add support of PropertyAssignment and StringLiteral * add support for js file * allow static modifier in js file
28 lines
730 B
TypeScript
28 lines
730 B
TypeScript
/// <reference path='fourslash.ts' />
|
|
|
|
//// class A {
|
|
//// /*a*/public a: number = 1;/*b*/
|
|
//// public _a: string = "foo";
|
|
//// public _a_1: string = "bar";
|
|
//// public _a_2: string = "baz";
|
|
//// }
|
|
|
|
goTo.select("a", "b");
|
|
edit.applyRefactor({
|
|
refactorName: "Generate 'get' and 'set' accessors",
|
|
actionName: "Generate 'get' and 'set' accessors",
|
|
actionDescription: "Generate 'get' and 'set' accessors",
|
|
newContent: `class A {
|
|
private /*RENAME*/_a_3: number = 1;
|
|
public get a(): number {
|
|
return this._a_3;
|
|
}
|
|
public set a(value: number) {
|
|
this._a_3 = value;
|
|
}
|
|
public _a: string = "foo";
|
|
public _a_1: string = "bar";
|
|
public _a_2: string = "baz";
|
|
}`,
|
|
});
|