Copy and paste the folded text into Visual Studio Code

Given the following text

Node1_L1 Node1_L2 Node2_L2 Node2_L1 Node3_L2 Node1_L3 Node2_L3 Node4_L2 Node3_L3 Node4_L3 Node3_L1 Node5_L2 Node6_L2 

I can use the built-in vscode folding function to collapse it so that it looks like this

 + Node1_L1 Node2_L1 + Node3_L2 + Node4_L2 Node3_L1 Node5_L2 Node6_L2 

but when I now select the folded text and copy and paste it, it actually captures all the text - also hidden. Thus, the result of copying and pasting the first 4 lines of the folded text will be

 Node1_L1 Node1_L2 Node2_L2 Node2_L1 Node3_L2 Node1_L3 Node2_L3 Node4_L2 

whereas I would like to have

 Node1_L1 Node2_L1 Node3_L2 Node4_L2 

Hope this makes sense and someone knows how to do it. Thanks!

+6
source share
1 answer

There may be another way to do this, but the workaround seems to be using a block selection with multiple cursors - see GIF

Select a block to copy only the top folding text of the top level

+1
source

All Articles