简体   繁体   中英

vscode auto folding on open file

What: Is there any way to open files in vscode and have it auto fold code for you?

Why: I only need to see most code a few times before I've memorized it, and at that point a reference with a peeked definition is all I need. Interfaces, classes, and types just take up my realestate. I want more of the most valuable code on the screen at a time. This means I need to hide some or all of the code when files are large.

Ideally: I'd like to just close specific types of code (ex. interfaces) for specific types of files (ex. typescript files) for files larger than arbitrary 55 lines long, but I would settle for just auto folding all code.

As far as I know that is not possible in vanilla vscode.

There is however an extension you might be interested in, which might do the trick for you: https://marketplace.visualstudio.com/items?itemName=bobmagicii.autofoldyeah

If you haven't tried it yet you might also want to check out "Go to symbol in file..." - it might help you navigate in larger files.

The hotkey for that is command-shift-o (on mac), if you type a colon afterwards it even sorts it into variables/functions etc.

Anyways - short answer, not possible without an extension.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM