Search code examples
visual-studio-codefolding

How can I move lines or folded regions before or after other folded regions?


Assume we have a folded region, let's say of 50 rows. Let's call it "TheRegion".

After TheRegion we've got a line. Let's call it "TheLine".

Now I want to move TheLine before TheRegion without cut-and-paste it but with the "moving the line up and down" feature.

If a do the "move-the-line-up" command TheRegion unfolds and TheLine moves to the 49th line of TheRegion...

This in not what I want. I want TheLine moves before TheRegion without unfolding it...

The same problem if I try to move a folded region or an unfolded selection before or after a folded region...

How can this be done with VS Code?


Solution

  • This is not currently possible.

    See this feature request issue: [folding] Move line up/down should skip over folded regions or folded sections #63972. (For your reference / learning purposes, this was found simply by googling "github vscode issues move line fold").

    You can give the issue a thumbs up to show support for it, and subscribe to get notified of discussion and updates. But please don't make noisy "+1" or "bump" comments.

    I am not aware of any workarounds.