TypeScript/tests/cases/fourslash/extract-method2.ts
Andrew Casey 2ea4cfe23b Insert a line break before a function at EOF if needed
This is a pre-existing issue that became more obvious after refining
trivia handling.
2017-10-12 14:19:36 -07:00

33 lines
816 B
TypeScript

/// <reference path='fourslash.ts' />
//// namespace NS {
//// class Q {
//// foo() {
//// console.log('100');
//// const m = 10, j = "hello", k = {x: "what"};
//// const q = /*start*/m + j + k/*end*/;
//// }
//// }
//// }
goTo.select('start', 'end')
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_3",
actionDescription: "Extract to function in global scope",
newContent:
`namespace NS {
class Q {
foo() {
console.log('100');
const m = 10, j = "hello", k = {x: "what"};
const q = /*RENAME*/newFunction(m, j, k);
}
}
}
function newFunction(m: number, j: string, k: { x: string; }) {
return m + j + k;
}
`
});