microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.2k stars 28.85k forks source link

[folding] Automatic function/method folding #33449

Open tlemo opened 7 years ago

tlemo commented 7 years ago

Please consider automatic function folding, based on the current cursor location.

I think it can be a great way to help developers maintain a high level mental map of source files and ease navigation between functions/methods. While it builds on existing building blocks already present in many code editors (block folding, tracking language specific scopes, ...) it may also be a novel approach (I'm not aware of any existing implementation)

The core idea is to edit source code with all functions folded by default, and expand the "current" function when the cursor enters it, then fold it back when the cursor leaves the function region. Explicit pins can allow developers to keep key functions expanded.

Full description of the proposal

aeschli commented 7 years ago

@tlemo Thanks for the detailed write-up.

tlemo commented 7 years ago

I'm a big VS Code fan and I love to see it evolving. I can see a few UX and implementation challenges that might make this harder than it seems, but I think that the proposed auto-folding approach would be a hit with a large segment of the developers.

The linked document is open for comments and I'd be happy to clarify or elaborate if questions come up.

str commented 7 years ago

I think my issue #35258 is a dup of this one

sumanth-lingappa commented 2 years ago

Is there any work on this request? I don't find any way I can fold functions/classes etc by default.

aeschli commented 2 years ago

No work is ongoing, the milestone is set to 'Backlog'

Jood80 commented 1 year ago

Can't wait to see its release

davidmelvin commented 1 year ago

I'd love this!

What42Pizza commented 1 year ago

I'd also like to have this

ooddaa commented 1 year ago

It'd be very convenient to open a file and have all code folded by default.

mikhaillampu commented 11 months ago

Please consider implementing this feature

NoahPrentice commented 10 months ago

Would also love this!

jumpcuts commented 8 months ago

Would love this. Currently we run Fold All command everytiime I open a file If there is a toggle if we want it to be auto folded or not, it would be great

trisdoan commented 7 months ago

There is an extension: felicio.vscode-fold

worth a try

Eorix commented 5 months ago

up

andr729 commented 2 weeks ago

Would love a version of this that would allow you to auto-fold any file larger (e.g., in lines of code) than XYZ.