Skip to main content

Overview

This guide covers advanced features and techniques for using Draw Folder Structure in complex projects. Learn how to optimize performance, combine settings strategically, and handle edge cases.

Recursion Control

The allowRecursion setting controls whether the extension explores subdirectories when generating structures.

How It Works

When you right-click on a folder:
  • allowRecursion: true (default) - Generates a complete tree of all subdirectories
  • allowRecursion: false - Shows only immediate children (one level deep)

Configuration

{
  "draw.folder.structure.allowRecursion": false
}

Use Cases

Top-Level Overview

Disable recursion when you only want to show the main structure:
{
  "draw.folder.structure.allowRecursion": false,
  "draw.folder.structure.style": "ClassicDashes"
}
Result for a project:
my-project
  └── src
  └── tests
  └── docs
  ├── package.json
  └── README.md
Perfect for high-level documentation that doesn’t need implementation details.
For very large projects (1000+ files), disabling recursion on the root folder improves generation speed:
{
  "draw.folder.structure.allowRecursion": false
}
Then selectively run the command on specific subdirectories with recursion enabled.
Generate separate structures for different sections:settings.json:
{
  "draw.folder.structure.allowRecursion": true
}
Workflow:
  1. Right-click src/ folder → Generate structure → Copy to “Source Code” section
  2. Right-click tests/ folder → Generate structure → Copy to “Test Suite” section
  3. Right-click docs/ folder → Generate structure → Copy to “Documentation” section

Recursion with Exclusions

Combine recursion with exclusions for fine-grained control:
{
  "draw.folder.structure.allowRecursion": true,
  "draw.folder.structure.exclude": [
    "**/node_modules",
    "**/dist",
    "**/coverage",
    "**/src/generated"  // Exclude specific deep paths
  ]
}
This allows recursive exploration but skips specified directories.

.gitignore Integration

The respectGitignore setting instructs the extension to honor your project’s .gitignore rules.

How It Works

When enabled, the extension:
  1. Locates the .gitignore file in your project root
  2. Parses the patterns defined in it
  3. Excludes any matching files or folders from the generated structure

Configuration

{
  "draw.folder.structure.respectGitignore": true
}

Use Cases

Clean Repository View

Show only files that are tracked by Git:
{
  "draw.folder.structure.respectGitignore": true,
  "draw.folder.structure.exclude": [
    "**/.git"  // Still exclude .git folder itself
  ]
}
This is perfect for documentation that mirrors your repository structure.
Your .gitignore typically excludes:
  • Environment files (.env, .env.local)
  • Build artifacts
  • Dependencies
  • IDE files
Enable respectGitignore to automatically exclude all of these without manually configuring exclusion patterns.
When your team shares a .gitignore, enabling this setting ensures everyone generates consistent structure documentation:
{
  "draw.folder.structure.respectGitignore": true
}
Commit this configuration in .vscode/settings.json for team-wide consistency.

Combining with Exclusion Patterns

Exclusion patterns and .gitignore work additively:
{
  "draw.folder.structure.exclude": [
    "**/node_modules",
    "**/temp"  // Additional exclusions beyond .gitignore
  ],
  "draw.folder.structure.respectGitignore": true
}
Files matching either source will be excluded.
There’s no way to “un-exclude” something from .gitignore. If a file is ignored by Git and you want it in your structure, you must disable respectGitignore.

Example Scenario

Your .gitignore:
node_modules/
.env
*.log
dist/
coverage/
Your settings.json:
{
  "draw.folder.structure.respectGitignore": true,
  "draw.folder.structure.exclude": [
    "**/.git",
    "**/docs/drafts"  // Extra exclusion not in .gitignore
  ]
}
Result: Excludes everything from .gitignore PLUS docs/drafts/.

Combining Multiple Settings

The real power comes from combining all settings for complex scenarios.

Scenario 1: Large Monorepo

Challenge: Generate documentation for a monorepo with multiple packages. Solution:
{
  "draw.folder.structure.exclude": [
    "**/node_modules",
    "**/.git",
    "**/dist",
    "**/coverage",
    "**/.turbo",
    "**/packages/*/node_modules"  // Exclude nested node_modules
  ],
  "draw.folder.structure.style": "ClassicDashes",
  "draw.folder.structure.allowRecursion": true,
  "draw.folder.structure.respectGitignore": true
}
Workflow:
  1. Right-click the packages/ folder to see all packages
  2. Right-click individual packages for detailed views

Scenario 2: Documentation-Only Structure

Challenge: Show only source files relevant for documentation. Solution:
{
  "draw.folder.structure.exclude": [
    "**/node_modules",
    "**/.git",
    "**/dist",
    "**/build",
    "**/*.test.{js,ts,jsx,tsx}",
    "**/*.spec.{js,ts,jsx,tsx}",
    "**/__tests__",
    "**/coverage",
    "**/.vscode",
    "**/.idea",
    "**/*.config.{js,ts}",
    "**/package-lock.json"
  ],
  "draw.folder.structure.style": "EmojiDashes",
  "draw.folder.structure.allowRecursion": true,
  "draw.folder.structure.respectGitignore": false
}
This shows a clean structure with only source files and documentation.

Scenario 3: API Documentation

Challenge: Document only the API routes and handlers. Solution:
{
  "draw.folder.structure.exclude": [
    "**/node_modules",
    "**/.git",
    "**/dist",
    "**/components",  // Exclude frontend code
    "**/styles",
    "**/public",
    "**/*.test.*"
  ],
  "draw.folder.structure.style": "Arrows",
  "draw.folder.structure.allowRecursion": true,
  "draw.folder.structure.respectGitignore": false
}
Workflow: Right-click the api/ or routes/ folder to generate API-specific documentation.

Scenario 4: Quick Root Overview

Challenge: Show only the root-level structure for project README. Solution:
{
  "draw.folder.structure.exclude": [
    "**/node_modules",
    "**/.git"
  ],
  "draw.folder.structure.style": "MinimalistDots",
  "draw.folder.structure.allowRecursion": false,  // Key setting
  "draw.folder.structure.respectGitignore": false
}
Perfect for README files that need a birds-eye view.

Scenario 5: Multi-Language Project

Challenge: Document a project with backend and frontend in different languages. Solution:
{
  "draw.folder.structure.exclude": [
    "**/node_modules",
    "**/__pycache__",
    "**/venv",
    "**/.git",
    "**/dist",
    "**/build",
    "**/target",  // Rust/Java
    "**/vendor"   // Go/PHP
  ],
  "draw.folder.structure.style": "NestedCircles",
  "draw.folder.structure.allowRecursion": true,
  "draw.folder.structure.respectGitignore": true
}
Excludes common build artifacts across multiple language ecosystems.

Performance Tips

Optimize structure generation for large projects:

Exclude Large Directories First

Always exclude the largest directories:
{
  "draw.folder.structure.exclude": [
    "**/node_modules",  // Often 100k+ files
    "**/.git",          // Git history
    "**/dist",
    "**/build"
  ]
}
This can reduce generation time from minutes to seconds.
For projects with 1000+ files:
  1. Disable recursion at root level:
    {"draw.folder.structure.allowRecursion": false}
    
  2. Generate top-level structure
  3. Re-enable recursion:
    {"draw.folder.structure.allowRecursion": true}
    
  4. Generate structures for specific subdirectories
This gives you control over which parts to explore deeply.
Enable respectGitignore to automatically exclude most irrelevant files:
{
  "draw.folder.structure.respectGitignore": true
}
This is faster than maintaining extensive exclusion lists.
Slow (scans more files):
{"draw.folder.structure.exclude": ["**/test"]}
Faster (more specific):
{
  "draw.folder.structure.exclude": [
    "**/src/test",
    "**/lib/test"
  ]
}
More specific patterns reduce the scanning scope.

Workspace-Specific Configurations

For projects with unique requirements, use workspace settings.

Creating Workspace Settings

  1. Create .vscode/settings.json in your project root:
{
  "draw.folder.structure.exclude": [
    "**/node_modules",
    "**/.git",
    "**/dist",
    "**/packages/legacy"  // Project-specific
  ],
  "draw.folder.structure.style": "EmojiDashes",
  "draw.folder.structure.allowRecursion": true,
  "draw.folder.structure.respectGitignore": true
}
  1. Commit this file to version control
  2. Team members get consistent structure generation

Multiple Profile Strategy

Use VS Code profiles for different documentation needs: Profile 1: Developer Documentation
{
  "draw.folder.structure.exclude": ["**/node_modules", "**/.git"],
  "draw.folder.structure.style": "ClassicDashes",
  "draw.folder.structure.allowRecursion": true,
  "draw.folder.structure.respectGitignore": false
}
Profile 2: User Documentation
{
  "draw.folder.structure.exclude": [
    "**/node_modules",
    "**/.git",
    "**/tests",
    "**/*.test.*",
    "**/internal"
  ],
  "draw.folder.structure.style": "EmojiFun",
  "draw.folder.structure.allowRecursion": true,
  "draw.folder.structure.respectGitignore": true
}
Switch profiles depending on your documentation audience.

Advanced Exclusion Techniques

Dynamic Exclusions Based on Context

Adjust exclusions for different contexts:
{
  "draw.folder.structure.exclude": [
    "**/node_modules",
    "**/.git",
    "**/frontend",
    "**/components",
    "**/styles",
    "**/public"
  ]
}

Excluding Generated Code

Many projects have code generation tools. Exclude generated files:
{
  "draw.folder.structure.exclude": [
    "**/node_modules",
    "**/.git",
    "**/__generated__",        // Relay, GraphQL
    "**/generated",
    "**/*.generated.{ts,js}",
    "**/migrations/*.ts",      // Database migrations
    "**/prisma/client"        // Prisma client
  ]
}

Troubleshooting

Causes:
  • Not excluding large directories (node_modules, .git)
  • Too many files being scanned
Solutions:
  1. Add common exclusions:
    {
      "draw.folder.structure.exclude": [
        "**/node_modules",
        "**/.git",
        "**/dist"
      ]
    }
    
  2. Enable respectGitignore
  3. Try allowRecursion: false for initial scan
Causes:
  • Too aggressive exclusion patterns
  • .gitignore excluding necessary files
Solutions:
  1. Review your exclusion patterns
  2. Disable respectGitignore temporarily:
    {"draw.folder.structure.respectGitignore": false}
    
  3. Use negation patterns to include specific files:
    {
      "draw.folder.structure.exclude": [
        "**/config",
        "!**/config/important.js"
      ]
    }
    
Causes:
  • Recursion disabled when you need it
  • Workspace settings overriding user settings
Solutions:
  1. Check recursion setting:
    {"draw.folder.structure.allowRecursion": true}
    
  2. Check for workspace settings in .vscode/settings.json
  3. Verify exclusion patterns are correct

Best Practices Summary

Start Simple

Begin with default settings and add exclusions as needed. Don’t over-configure initially.

Use .gitignore

Enable respectGitignore for automatic, consistent exclusions across your team.

Document Your Config

Add comments in .vscode/settings.json to explain project-specific patterns.

Test Incrementally

Make one configuration change at a time and test the output before adding more.

Real-World Examples

Next.js Blog Project

{
  "draw.folder.structure.exclude": [
    "**/node_modules",
    "**/.git",
    "**/.next",
    "**/out",
    "**/public/images",  // Large image directory
    "**/*.lock"
  ],
  "draw.folder.structure.style": "EmojiDashes",
  "draw.folder.structure.allowRecursion": true,
  "draw.folder.structure.respectGitignore": true
}

React Component Library

{
  "draw.folder.structure.exclude": [
    "**/node_modules",
    "**/.git",
    "**/dist",
    "**/storybook-static",
    "**/*.test.tsx",
    "**/*.stories.tsx",
    "**/coverage"
  ],
  "draw.folder.structure.style": "NestedCircles",
  "draw.folder.structure.allowRecursion": true,
  "draw.folder.structure.respectGitignore": false
}

Express.js API Server

{
  "draw.folder.structure.exclude": [
    "**/node_modules",
    "**/.git",
    "**/dist",
    "**/logs",
    "**/*.log",
    "**/coverage",
    "**/*.test.js"
  ],
  "draw.folder.structure.style": "ClassicDashes",
  "draw.folder.structure.allowRecursion": true,
  "draw.folder.structure.respectGitignore": true
}

Next Steps

Configuration Reference

Detailed reference for all configuration options

Exclusion Patterns

Deep dive into glob pattern syntax

Styling Options

Explore all available visual styles

API Reference

Complete API documentation

Build docs developers (and LLMs) love