mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-16 07:13:43 -05:00
remove explicit escaping for placeholder opening
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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}`",
|
||||
});
|
||||
Reference in New Issue
Block a user