2017-09-20 23:48:11 +02:00
|
|
|
/// <reference path='fourslash.ts' />
|
|
|
|
|
|
|
|
// Handle having zero modifiers on a method.
|
|
|
|
|
|
|
|
// @allowNonTsExtensions: true
|
|
|
|
// @Filename: file1.js
|
|
|
|
//// class C {
|
|
|
|
//// M() {
|
|
|
|
//// const q = /*a*/1 + 2/*b*/;
|
|
|
|
//// q.toString();
|
|
|
|
//// }
|
|
|
|
//// }
|
|
|
|
|
|
|
|
goTo.select('a', 'b')
|
|
|
|
edit.applyRefactor({
|
2017-09-15 01:04:44 +02:00
|
|
|
refactorName: "Extract Symbol",
|
|
|
|
actionName: "function_scope_1",
|
2017-09-20 23:48:11 +02:00
|
|
|
actionDescription: "Extract to method in class 'C'",
|
|
|
|
newContent:
|
|
|
|
`class C {
|
|
|
|
M() {
|
2017-09-15 01:04:44 +02:00
|
|
|
const q = this./*RENAME*/newMethod();
|
2017-09-20 23:48:11 +02:00
|
|
|
q.toString();
|
|
|
|
}
|
|
|
|
|
2017-09-15 01:04:44 +02:00
|
|
|
newMethod() {
|
2017-09-20 23:48:11 +02:00
|
|
|
return 1 + 2;
|
|
|
|
}
|
|
|
|
}`
|
|
|
|
});
|