Skip to content
 
 

Repository files navigation

Fold More

This extension for VS Code let's you:

  1. Use the folding feature of VS Code to define arbitrary and named folding regions
  2. Define headlines for better code navigation and highlight significant points
  3. Navigate faster in your code using region labels and headlines in the navigation tree view
  4. Configure the marker colors for region labels and headlines in the extension settings
  5. Add comments in marker colors. These comments do not appear in the navigation tree view

Features

Arbitrary and Named Folding Regions

  • Each region marker must be on a separate line and start with //# for JavaScript/TypeScript or ## for Shell scripts.
  • Each marker is expected to contain a region label that is used to build the navigation tree view with the hierarchy of nested regions. Each region start marker is expected to have a corresponsing region end marker with the same region label.

You can use the following markers to define named folding regions:

Start marker (JS/TS) Start marker (Shell) End marker (JS/TS) End marker (Shell) Suggested purpose
//#{* ###{* //#*} ##*} Data types, structures, ...
//#{ ###{ //#} ##} Variables, objects, instances, ...
//#[ ##[ //#] ##] Arrays, lists, collections, tables, mappings, ...
//#( ##( //#) ##) Functions, methods, procedures, ...
//#< ##< //#> ##> General purpose sections or regions
  • You can use the markers as you like, the above purpose for the folding regions is only a suggestion.
  • The named regions will show in the navigation tree view where you can collapse/expand the regions and navigate to them by the region label.

Example of using the Fold More extention.

Headlines

  • You can define headlines on three levels that will show in the navigation tree view where you can navigate to them by the headline title.
Marker (JS/TS) Marker (Shell) Headline
//#1 ##1 Headline level 1
//#2 ##2 Headline level 2
//#3 ##3 Headline level 3

Example of using the Fold More extention.

Comments in Marker Colors

  • You can add comments in marker colors. These comments do not appear in the navigation tree view.
Marker (JS/TS) Marker (Shell) Color
//-1 ##-1 Headline level 1 color
//-2 ##-2 Headline level 2 color
//-3 ##-3 Headline level 3 color
//-{* ##-{* {* *} region color
//-{ ##-{ { } region color
//-( ##-( ( ) region color
//-[ ##-[ [ ] region color
//-< ##-< < > region color

Example of using the Fold More extention.

Navigation Tree View

  • You can navigate faster in your code using region labels and headlines in the navigation tree view.
  • You build the navigation tree explicitly by defining named regions and headlines of significance.
  • To open the view, go to View | Open View... and search for Fold More

Example of using the Fold More extention.

Supported Languages

Currently supported languages:

  • JavaScript (C-style line-comments starting with //)
  • TypeScript (C-style line-comments starting with //)
  • Shell Script (line-comments starting with #)

Extension Settings

You can configure the marker colors for region labels and headlines in the extension settings:

  1. Open the Settings and search for foldmore

    VS Code Settings for FoldMore Extension

  2. Click on Edit settings.json to edit the styles (syntax and icon colors)

    VS Code Settings for FoldMore Extension

Build VSIX

Package the extension into a .vsix file:

npm install
npx @vscode/vsce package

This creates vscode-foldmore-<version>.vsix in the project root.

Release Notes

See the Change Log

About

Fold More - Visual Studio Code Extension

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages