TypeScript Semantic Paste
(escapes pasted text based on where the cursor is positioned)
Windows / Linux | Mac |
---|---|
ctrl +shift +x |
cmd +shift +x |
- Type
Paste
- Find
Paste Escaped
- Click the
Install
button - Click the
Reload
button
Windows / Linux | Mac |
---|---|
ctrl +shift +v |
cmd +shift +v |
Windows / Linux | Mac |
---|---|
ctrl +z |
cmd +z |
-
Press once to undo the escaping (leaving you with the raw clipboard text).
-
Press a second time to undo the entire paste operation.
Windows / Linux | Mac |
---|---|
ctrl +shift +p |
cmd +shift +p |
- Type
Paste
- Select the option
Paste: Escaped
Escapes clipboard text in the following scenarios with |
being the cursor position:
✔️ const test = `|`;
✔️ const test = "|";
✔️ const test = '|';
✔️ const test = /|/g;
✔️ const test = 123; // |
✔️ const test = /* | */ 123;
👌 any.other.code |
(no escaping)
Text in clipboard:
📋
<text property="${donteval}" folder="C:\temp"/>
<name first='John\`s' last="Tools"/>`
const abc = ``;
const abc = `<text property="${donteval}" folder="C:\temp"/>
<name first='John`s' last="Tools"/>`;
${donteval}
a template variable (may not be intentional)
✖️ Replaces \t
in the C:\\temp
path with a literal TAB
✖️ Breaks the string immediately following John
causing compilation errors
const abc = `<text property="\${donteval}" folder="C:\\temp"/>
<name first='John\`s' last="Tools"/>`;
✔️ The ${donteval}
exists as verbatim text and will not look for a variable named donteval
✔️ Does not replace part of the path with a TAB
✔️ The string ends where expected 😲
const def = "";
const def = "<text property="${donteval}" folder="C:\temp"/>
<name first='John`s' last="Tools"/>"
✖️ Breaks the string immediately following property=
(and several other places) causing compilation errors
✖️ Adds a line break causing additional compilation errors
✖️ Replaces \t
in the C:\\temp
path with a literal TAB
const def = "<text property=\"${donteval}\" path=\"C:\\temp\"/>\n<name first='John`s' last=\"Tools\"/>";
✔️ Escapes all quotes and backslashes (\
)
✔️ Escapes the line break with \n
(or \r\n
if that were on the clipboard)
✔️ The string ends where expected