Skip to content
| Marketplace
Sign in
Visual Studio Code>Visualization>Auto Fold & UnfoldNew to Visual Studio Code? Get it now.
Auto Fold & Unfold

Auto Fold & Unfold

Levi Augusto Pires

|
3,081 installs
| (6) | Free
Auto fold and unfold to visually manage the code size.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Auto Fold & Unfold for VS Code v0.9.0

This extension is under construction. Auto F&U automatically folds and unfolds when the cursor enters or leaves the function.

How to install

code --install-extension levipires.auto-fold-unfold

or download it from the Marketplace.

How to use

It's simple! You just need to place the cursor inside a function for it to open. And guess what happens if you leave the function!? Exactly! It magically closes and puts miles of code under one line. It's a piece of cake.

And now, if you are using version 0.4.0 or higher, you can use this same magic when saving, when opening a file and when changing between files. It's all an option.

AU Demo

Release Notes

The version 0.9.0 of the extension contains the following improvements:

  • The code was refactored. The best mode works nearly 25% faster and the fast mode works 5% faster
  • Other minor improvements were made like a better update message

-> See Changelog

Settings

{
  /**
   * These settings can be configured in the user, remote, workspace or folder settings.
   *
   * @deprecated
   * auto-fold-unfold.onEdit
   * auto-fold-unfold.behaviorOnEdit
   * auto-fold-unfold.modeOnEdit
   * @deprecated
   */

  /**
   * Folding and unfolding while editing.
   */
  "auto-fold-unfold.onEditing": {
    /**
     * You can disable this feature in case you don't like it.
     */
    "enable": true,

    /**
     * Defines fold behavior while editing.
     * If "fast", this extension will do it's job in approximately 50ms per step,
     * but the folding will be limited to the first 7 levels.
     * If "best", performance will be dictated by the level you are entering
     * and the power of your computer (approximately 120ms per step), but you will experience unlimited folding.
     * I advise you to use the "best" setting only if your code is a tangle of objects
     * containing a 45 generation family.
     */
    "foldMode": "fast",

    /**
     * Defines unfold behavior while editing.
     * If "parent", only the block where the cursor is will be unfolded.
     * If "family", the block where the cursor is and it's children will be unfolded.
     */
    "unfoldMode": "parent"
  },

  /**
   * Folds all whenever a file is opened or the active editor changes.
   * This option might reduce productivity.
   */
  "auto-fold-unfold.onDidChangeActiveTextEditor": false,

  /**
   * Folds all when the document is saved.
   * For the sake of data integrity the editor might save without firing this event.
   */
  "auto-fold-unfold.onSaved": false
}

Commands

Command Keybinding Description
auto-fold-unfold.foldAndClose ctrl+shift+/ Folds the code and closes the editor. This command is an alternative to auto-fold-unfold.onDidChangeActiveTextEditor.
auto-fold-unfold.onEditing.toggleFreeze ctrl+; f Freezes the folding functionality while Editing
auto-fold-unfold.onEditing.togglePause ctrl+; p Pauses the folding functionality while editing
auto-fold-unfold.onEditing.toggleBoth ctrl+; ctrl+; Freezes and pauses the folding functionality while editing

Requirements

This extension doesn't have any requirement.

Limitations

This is a under construction version. Please log any issues you find on GitHub.

Did you like it?

Give me five stars

How to find me

  • Email: waltvy.comercial@gmail.com

  • LinkedIn

  • GitHub

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft