Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does VSCode can escape text when pasting into a string literal?

Eclipse has an option that copy-paste of multi-line text into String literals will result in quoted newlines.

Preferences > Java > Editor > Typing > Escape text when pasting into a string literal

Does vscode can do it?

for example

copy bellow and paste:

some text with tabs and new lines

Then eclipse change like this:

"some text\twith tabs\r\n" + "and new \r\n" + "lines"

How can I do it in vscode?

like image 202
andy Avatar asked Oct 15 '25 23:10

andy


2 Answers

No, it can't at this moment. There is a closed issue for this at backlog without an estimation.

There is a plugin at marketplace that does the job, but for TypeScript.

like image 91
Cristóbal Ramos Merino Avatar answered Oct 17 '25 13:10

Cristóbal Ramos Merino


There is a plug that works for JavaScript and others now: https://marketplace.visualstudio.com/items?itemName=cvbge.escape-string

  • C
  • C++
  • C#
  • JavaScript
  • Python
  • TypeScript
like image 38
Grallen Avatar answered Oct 17 '25 14:10

Grallen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!