Vscode: [folding] Fold selection

Created on 19 Jan 2017  路  34Comments  路  Source: microsoft/vscode

In Visual Studio by doing Ctrl+M followed by Ctrl+H we were able to fold ANY regions in a code.
Could we please have an equivalent feature in Code. Thanks may God bless the dev team!

editor-folding feature-request

Most helpful comment

I think this feature request includes character-based (rather than line-based) code folding;
ex:
before folding:
screen shot 2017-09-10 at 12 37 34 am
after folding:
screen shot 2017-09-10 at 12 37 42 am

And I just wanted to point out that if this kind of feature were added, then myself and others could likely start working on extensions to handle these issues:

And likely some other issues as well.

All 34 comments

@alexandrudima FYI.

I think this feature request includes character-based (rather than line-based) code folding;
ex:
before folding:
screen shot 2017-09-10 at 12 37 34 am
after folding:
screen shot 2017-09-10 at 12 37 42 am

And I just wanted to point out that if this kind of feature were added, then myself and others could likely start working on extensions to handle these issues:

And likely some other issues as well.

+1 for this feature request. It's one of the more annoying things things I've found by switching over to this IDE than NuSphere PHPEd.

Any update on this?

This would be indeed a very useful feature! I'm actually wondering if this is available in any other editors, apart from Visual Studio?

@paulomunoz: I'm not sure whether this is exactly what @bbofdoom is requesting but Atom has something that's, at least, similar (from https://flight-manual.atom.io/using-atom/sections/folding/):

Finally, you can fold arbitrary sections of your code or text by making a selection and then typing Alt+Cmd+Ctrl+F or choosing "Fold Selection" in the Command Palette.

Of course Sublime Text also has this for ages.
image

I'd love to see this feature as well :)

BTW I love visual studio code. The dev team is an inspiration.

What is shortcuts for that? Does folding selection exist already in VSCode?

It's one and a half years after this feature request has been opened, is there any progress on this? I think it's actually kind of unusual for an editor to not have this as a feature, so I'd like to give a +1 for this.

I mainly use RubyMine for my daily work and use cmd + and cmd - to unfold/fold region wise and cmd shift + and cmd shift - to unfold/fold the whole file.

I'd like this as well

This is a fairly basic feature, please add

Badly need this. Please add

Back to coding after taking many years off. I've only been using VS Code for a week or so and already I see the need for this feature. Please add it, thanks!

This feature is really needed. Cannot switch to VS Code without this (

Adding my vote for this feature. Great code folding includes folding selection(s).

Adding my vote as well, looking to hide lines that begin with a REGEX

Adding another vote for this feature; folding statements within a mustache template.

so many less important features released each month... and still not this fairly basic one!

Please add this feature! It makes such a difference and is something that I really miss after switching from Sublime to VS Code.

50840 is required to implement this

Bump +1

Bump

@hanselmandrew @JanChodorowski @yijiangh please do not post empty "+1" responses, that is what reactions are for.

Or the Subscribe button in the top right. 馃憤

it is also pretty pointless. This issue has been ongoing for 2.5 years with zero indication it is even being considered. Still, we can now keep the cursor centred in the window when scrolling, so who needs basic functionality?

Thanks to the recent activity, I just realized that I don't want this feature and I un-thumbed-up it.

I must have thought it was the feature that I really want: Collapse to definitions, like Visual Studio. Currently it seems like VS Code only works based on indentation levels.

Vote for fold selection! It is painful to scroll over whole screen for jumping over large blocks of comments and reading the important code

need this feature baked in to vs code. but this extension does the trick : #region

I was looking for this feature. Using Datagrip I can fold part of my queries. Can't believe that code really does not has this function.

Really really really need this feature!

BTW, I don't think this feature request includes character-based (rather than line-based) code folding as @jeff-hykin mentioned.
Actually, this feature can be considered as folding all the selection lines, rather than characters. Maybe it will make the implementation easier.

I've been using SlickEdit for some time and it's a great editor but I decided to try VS Code since I'm tired of paying maintenance on SlickEdit. SlickEdit can fold on ANY regex pattern, and it's a line fold, not a character fold. It's called Selective Display.

This is an extremely beneficial feature for me because I review log files from embedded devices a LOT and it's great to collapse the log file based on a regex so I can see a pattern emerge when looking for specifically logged items.

VS Code appears to be very flexibile, but I was very disappointed when I found that it couldn't do this.

Also, it seems kind of silly to me to have to put #region, #pragma region, etc in the code to get it to fold when you could just use a regex to easily fold on anything.

@dwall60 Thanks for the feedback. Would you mind filing a separate issue that also shows a bit how this works in SlickEdit. I'm curious to know how users provide the regexes and how the regexes look like (one regex for the whole region, or separate start end regexes)

I'll add my vote for this feature as well. Language aware folding might be nice, but just let me fold abritrary lines and you've got a solution already. I want to collapse, into a single line, every unit test in my file but for the one I'm working on. I want to collapse every controller method but for the one I'm working on. It's not enough to be able to collapse the functions themselves because that still displays the method signature.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sirius1024 picture sirius1024  路  3Comments

shanalikhan picture shanalikhan  路  3Comments

lukehoban picture lukehoban  路  3Comments

philipgiuliani picture philipgiuliani  路  3Comments

trstringer picture trstringer  路  3Comments