Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[folding] Fold selection #18805

Closed
bbofdoom opened this issue Jan 19, 2017 · 49 comments
Closed

[folding] Fold selection #18805

bbofdoom opened this issue Jan 19, 2017 · 49 comments
Assignees
Labels
editor-folding Editor code folding issues feature-request Request for new features or functionality on-testplan
Milestone

Comments

@bbofdoom
Copy link

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!

@dbaeumer dbaeumer added editor editor-folding Editor code folding issues labels Jan 20, 2017
@dbaeumer
Copy link
Member

@alexandrudima FYI.

@aeschli aeschli changed the title Fold any regions [folding] Fold selection Jan 23, 2017
@aeschli aeschli added the feature-request Request for new features or functionality label Jan 23, 2017
@aeschli aeschli added this to the Backlog milestone Jan 23, 2017
@jeff-hykin
Copy link

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.

@JBrace1990
Copy link

+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.

@coodoo
Copy link

coodoo commented Oct 27, 2017

Any update on this?

@alexdima alexdima removed the editor label Nov 24, 2017
@paulomunoz
Copy link

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

@ghost
Copy link

ghost commented Mar 7, 2018

@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.

@ackvf
Copy link

ackvf commented Apr 3, 2018

Of course Sublime Text also has this for ages.
image

@MartinJHammer
Copy link

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

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

@wzup
Copy link

wzup commented Jun 30, 2018

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

@andersennl
Copy link

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.

@BinaryShrub
Copy link

I'd like this as well

@tomatau
Copy link

tomatau commented Oct 8, 2018

This is a fairly basic feature, please add

@bjoe88
Copy link

bjoe88 commented Oct 24, 2018

Badly need this. Please add

@peterallcdn
Copy link

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!

@Inversion-des
Copy link

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

@tony-thomas-git
Copy link

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

@iladin
Copy link

iladin commented Dec 21, 2018

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

@AerionDyseti
Copy link

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

@julesgilson
Copy link

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

@coconewty
Copy link

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

@Tiedye
Copy link

Tiedye commented Feb 21, 2019

#50840 is required to implement this

@hanselmandrew
Copy link

Bump +1

@psycoxer
Copy link

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

@eliumoraes
Copy link

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.

@zhouyc98
Copy link

zhouyc98 commented Jun 5, 2020

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.

@dwall60
Copy link

dwall60 commented Aug 13, 2020

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.

@aeschli
Copy link
Contributor

aeschli commented Aug 14, 2020

@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)

@commadelimited
Copy link

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.

@yubaoquan
Copy link

yubaoquan commented Dec 8, 2020

Three years... this issue still open.

@RaptorX
Copy link

RaptorX commented Dec 8, 2020

came to post a request and found this issue laying around still :(
wont even bother.

@igorcmelo
Copy link

Sadly it stills open

@NotWearingPants
Copy link
Contributor

Inline folding is here: #50840

@Nice2Work
Copy link

Yes please, I do not think there is one cursor move I do all day, and that is putting at the begin and than CTRL + [, while I would love to just select and CTRL + whatever to do all parts folding that can be folded into each their own...
But I am afraid we are talking to some deaf ears as this is already requested ....> 3 years now?

@Nick-Hopps
Copy link

Nick-Hopps commented Jun 29, 2021

How to fold/unfold selected contents?seems that folding/unfolding only works on the specific region or the whole document.

@exquisitesteve1
Copy link

I would like this feature too

@yayayahahaha
Copy link

Any update?
I'm trying to migrate from SublimeText to VSCode, but it seems both of them just can't replace another.

@tjx666
Copy link
Contributor

tjx666 commented Jan 24, 2022

Sometime would be very helpful with this.

@aeschli aeschli modified the milestones: Backlog, July 2022 Jul 25, 2022
This was referenced Jul 25, 2022
@aeschli aeschli closed this as completed Jul 25, 2022
@jeff-hykin
Copy link

jeff-hykin commented Jul 25, 2022

After 5 years of waiting, I'm glad to see the update. Thanks @aeschli!

@yayayahahaha
Copy link

So exciting to see this feature!

@commadelimited
Copy link

commadelimited commented Jul 26, 2022

Thanks @aeschli! Do you have an idea of when this will actually be released? I can't wait to use it.

Kudos to all your hard work (and to whomever else was involved).

@eliumoraes
Copy link

Thank you very much! Never believed that would be released. I'm grateful! Thanks again!

@Tiedye
Copy link

Tiedye commented Aug 6, 2022

The feature doesn't seem to work as it does in the referenced apps. If I select a range in one line it doesn't do anything, folding part way through a line also doesn't work. It only seems to be able to collapse whole lines

@aeschli
Copy link
Contributor

aeschli commented Aug 25, 2022

Yes. we still only support folding full lines, not subranges. So you need to select the lines to fold.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-folding Editor code folding issues feature-request Request for new features or functionality on-testplan
Projects
None yet
Development

No branches or pull requests