2017-09-07 23:30:19 +02:00
|
|
|
/// <reference path='fourslash.ts' />
|
|
|
|
|
|
|
|
////function f(x: number): number {
|
|
|
|
//// /*start*/switch (x) {case 0:
|
|
|
|
////return 0;}/*end*/
|
|
|
|
////}
|
|
|
|
|
|
|
|
goTo.select('start', 'end')
|
|
|
|
edit.applyRefactor({
|
2017-09-15 01:04:44 +02:00
|
|
|
refactorName: "Extract Symbol",
|
|
|
|
actionName: "function_scope_1",
|
2017-09-09 14:52:52 +02:00
|
|
|
actionDescription: "Extract to function in global scope",
|
2017-09-13 18:02:10 +02:00
|
|
|
newContent: `function f(x: number): number {
|
|
|
|
return /*RENAME*/newFunction(x);
|
2017-09-07 23:30:19 +02:00
|
|
|
}
|
2017-10-12 20:37:31 +02:00
|
|
|
|
2017-09-07 23:30:19 +02:00
|
|
|
function newFunction(x: number) {
|
|
|
|
switch (x) {
|
|
|
|
case 0:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2017-09-13 18:02:10 +02:00
|
|
|
`
|
|
|
|
});
|