On VSC, can I copy/paste folded codes and keep them folded?

Viewed 172

For example, if I fold code

div
something here
/div

into

div...
/div

And copy and paste the folded code, the result appears as unfolded code lines. Is there any way to keep them folded when paste? It looks like it is default on pycharm. :(

2 Answers

Here is the way:

Step1: Open your code in vscode

Step2: Cmd + Shift + P (Mac) or Ctrl+Shift+P (Windows) to open Command Palette, search and select Fold All

Step3: Toolbar -> Selection -> Column Selection Mode

Step4: Column select all the code, copy and paste, done!

Related