Logical-Direction
Logical-Direction

Reputation: 51

Copy & Paste folded Code in Visual Studio Code

When I copy folded code it just pastes the beginning line (that's visible).

For example if I copy this code when it's folded:

Expanded(
  flex: 2,    
  child: Image(
    image: AssetImage('images/dice1.png'),
  ),
),

It will just paste the starting code:

Expanded(

Upvotes: 5

Views: 4644

Answers (3)

dvdblk
dvdblk

Reputation: 2905

Just select and copy up to the next line (after the fold).

Upvotes: 0

Bichr Braighle
Bichr Braighle

Reputation: 1

in Visual Studio Code just press ( Ctrl + Shift + [ ) to fold code and ( Ctrl + Shift + Down ) to selected code.
and then copy selected code ( Ctrl + c ).
in mac:
Command = ctrl
Options = alt

Upvotes: -1

Guillermo Brachetta
Guillermo Brachetta

Reputation: 4745

You have to select also the end of the folded range to successfully copy all the folded content.

See this issue.

A workaround could be to add this line in settings.json:

"editor.foldingStrategy": "indentation"

That would make visible that ending range making it possible for you to select up to it and including it.

Upvotes: 3

Related Questions