Overview Version History Q & A Rating & Review
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
VSCode Marketplace: Search for "NestGen" in the VSCode Extensions Marketplace
Install: Click on "Install" to add NestGen to your VSCode setup
Reload: Reload VSCode to activate NestGen
Extension Configuration Settings
This extension contributes the following setting:
nestgen.maxDepth: (number) Maximum depth for tree generation
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)
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
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!