Skip to content

eshan-sud/nestgen

Repository files navigation

Visual Studio Marketplace

NestGen

  • Visualise & export the file/directory structure of your current workspace in one click
  • Automatic file structure generation using Watch Mode
  • Current version : 1.0.0

Commands

  • NestGen: Generate File Structure
  • NestGen: Toggle Watch Mode

Features

  • 📁 Generate directory tree for any workspace or folder
  • 📝 Export structure to file (.txt, .md, or .json)
  • 📋 Copy generated tree to clipboard
  • ⚙️ Configurable maximum depth for traversal
  • 📂 Respects .gitignore rules
  • 🚫 Automatically excludes .git directories
  • 🔠 Alphabetically sorts files & folders
  • 🖱️ Status bar button for one-click generation
  • 👀 In-editor preview with silent live updates
  • 🔄 Watch Mode to auto-regenerate on file changes
  • ⏱️ Debounced filesystem watching for performance
  • ♻️ Watch state persists across reloads
  • 🧩 Multi-root workspace support
  • 📦 Multiple output formats (Plain Text, Markdown, JSON)
  • 🔌 Public API for other extensions & tools
  • 🚀 Async filesystem traversal for large workspaces

Requirements

  • No external dependencies
  • Works out-of-the-box with VS Code 1.102.0 and above

Installation

  1. VSCode Marketplace: Search for "NestGen" in the VSCode Extensions Marketplace
  2. Install: Click on "Install" to add NestGen to your VSCode setup
  3. Reload: Reload VSCode to activate NestGen

Extension Configuration Settings

This extension contributes the following setting:

  • nestgen.maxDepth: (number) Maximum depth for tree generation
    • Default is 10
  • fileStructureGenerator.watchMode: (boolean)
    • Automatically regenerate file structure when files change
    • Default: false

Public API (For Other Extensions)

NestGen exposes a public API that allows other VS Code extensions to generate a file/directory tree programmatically

Usage

const nestgen = vscode.extensions.getExtension("eshansud.nestgen");

if (nestgen) {
  await nestgen.activate();
  const { generateTree } = nestgen.exports;

  const tree = await generateTree("/absolute/path/to/workspace", {
    maxDepth: 5,
    format: "text", // "text" | "md" | "json"
  });

  console.log(tree);
}

generateTree(rootPath, options)

  • Parameters
Name Type Description
rootPath string Absolute path to the directory to scan
options.maxDepth number Maximum traversal depth
options.format "text" | "md" | "json" Output format
  • Returns
Promise<string>;

Known Issues

  • Clipboard copy might not work in some remote/SSH VS Code contexts
  • Very large workspaces may take longer to generate the initial tree

Changelog

Contributing

  • Suggestions, issues, & contributions are welcome!

License

MIT


We value your feedback! If you encounter any issues or have suggestions for improvement, please don't hesitate to file an issue on our GitHub repository.

Enjoy!

About

VS Code extension for generating project file structures in one-click

Topics

Resources

License

Stars

Watchers

Forks

Contributors