remove explicit escaping for placeholder opening

This commit is contained in:
BigAru
2019-06-30 19:32:26 +02:00
parent 04f96db89d
commit 3e0d34cdd8
2 changed files with 1 additions and 19 deletions

View File

@@ -198,7 +198,7 @@ namespace ts.refactor.convertStringOrTemplateLiteral {
index++;
}
text = escapeText(text);
text = escapeString(text);
return [index, text, indexes];
}
@@ -247,10 +247,4 @@ namespace ts.refactor.convertStringOrTemplateLiteral {
}
return node;
}
function escapeText(content: string) {
return content.replace("`", "\`") // back-tick
.replace("${", "$\\{"); // placeholder alike beginning
}
}

View File

@@ -1,12 +0,0 @@
/// <reference path='fourslash.ts' />
//// const foo = "/*x*/w/*y*/ith ${dollar}"
goTo.select("x", "y");
edit.applyRefactor({
refactorName: "Convert string concatenation or template literal",
actionName: "Convert to template literal",
actionDescription: "Convert to template literal",
newContent:
"const foo = `with $\\\\{dollar}`",
});