TypeScript/tests/cases/fourslash/textChangesPreserveNewlines9.ts
Andrew Branch 3d22a4fd72
Preserve newlines between try/catch/finally, if/else, do/while (#39280)
* Preserve newlines between try/catch, if/else, do/while

* Update baselines
2020-06-26 14:48:19 -07:00

58 lines
912 B
TypeScript

/// <reference path="fourslash.ts" />
////function foo() {
//// /*1*/if (true) {
//// console.log(1);
//// } else {
//// console.log(1);
//// }
////
//// do {
//// console.log(1);
//// }
////
//// while (true);
////
//// try {
//// console.log(1);
//// } catch {
//// void 0;
//// } finally {
//// void 0;
//// }/*2*/
////}
goTo.select("1", "2");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_1",
actionDescription: "Extract to function in global scope",
newContent:
`function foo() {
/*RENAME*/newFunction();
}
function newFunction() {
if (true) {
console.log(1);
} else {
console.log(1);
}
do {
console.log(1);
}
while (true);
try {
console.log(1);
} catch {
void 0;
} finally {
void 0;
}
}
`
});