Project Structure Finder
A VS Code extension that scans your workspace and generates a structured text file with optional file contents, using an interactive sidebar UI with checkboxes.
Features
- Interactive Sidebar — A dedicated activity bar panel showing your entire workspace as a file tree
- Checkbox Selection — Click any file or folder to toggle it in/out. Parent folders show indeterminate state when partially selected
- Smart Defaults — Common noise folders and files are automatically excluded on first load (
node_modules, .git, dist, *.log, *.lock, binary files, etc.)
- Include File Contents — Toggle a global option to embed the full text of selected files in the output
- Large File Safety — Files exceeding the configured size limit are noted but not embedded (configurable, default 512 KB)
- Binary File Detection — Images, archives, compiled binaries, fonts etc. are always skipped for content inclusion
- Async Performance — All scanning and generation is non-blocking; large projects stay responsive
- Lazy Loading — Excluded directories are only scanned when you expand them, keeping startup fast
Installation & Running
Prerequisites
Setup
cd project-structure-finder
npm install
npm run compile # one-time build
# OR
npm run watch # continuous compilation (recommended during development)
Launch in Extension Development Host
- Open the project folder in VS Code
- Press F5 (or go to the Run and Debug view and click the Start Debugging play button) — this opens a new VS Code window with the extension loaded.
- Alternative: Open the Command Palette (
Ctrl+Shift+P) and run "Debug: Start Debugging".
- The Project Structure icon appears in the Activity Bar on the left
Usage
| Action |
How |
| Open panel |
Click the folder-code icon in the Activity Bar |
| Toggle a file/folder |
Click its row in the tree |
| Select All |
Toolbar → $(check-all) icon or context menu |
| Deselect All |
Toolbar → $(close-all) icon or context menu |
| Toggle File Contents |
Toolbar → $(file-text) icon |
| Refresh (re-scan) |
Toolbar → $(refresh) icon |
| Reset to Defaults |
Toolbar → $(discard) icon |
Generating the File
Click the $(file-code) Generate button in the sidebar toolbar, or run:
Ctrl+Shift+P → "Project Structure: Generate Project Structure File"
You will be prompted for an output file name (default: project-structure.txt). The file is written to the workspace root.
================================================================================
PROJECT STRUCTURE: my-project
Generated: 2024-01-15T10:30:00.000Z
File Contents: Included
================================================================================
📁 DIRECTORY TREE
--------------------------------------------------------------------------------
my-project/
├── 📁 src/
│ ├── 📄 extension.ts
│ ├── 📄 types.ts
│ └── 📄 utils.ts
├── 📄 package.json
└── 📄 README.md
================================================================================
FILE CONTENTS
================================================================================
--------------------------------------------------------------------------------
📄 src/extension.ts
--------------------------------------------------------------------------------
import * as vscode from 'vscode';
// ... file content here ...
--------------------------------------------------------------------------------
📄 package.json
--------------------------------------------------------------------------------
{
"name": "my-project",
...
}
================================================================================
SUMMARY
--------------------------------------------------------------------------------
Folders: 3
Total Files: 5
Included Files: 5
Skipped (excluded): 0
Skipped (too large): 0
Skipped (binary): 0
================================================================================
Configuration
All settings are under File > Preferences > Settings → search Project Structure:
| Setting |
Default |
Description |
projectStructure.maxFileSize |
512 |
Max file size in KB for content inclusion |
projectStructure.outputFileName |
project-structure.txt |
Default output file name |
projectStructure.defaultExcludePatterns |
(see below) |
Folder names excluded by default |
projectStructure.defaultExcludeFilePatterns |
(see below) |
File glob patterns excluded by default |
Default Excluded Folders
node_modules, .git, .svn, .hg, dist, build, out, .next, .nuxt, coverage, .nyc_output, venv, .venv, env, .env, __pycache__, .pytest_cache, .mypy_cache, logs, .DS_Store, .idea, .vs, .gradle, target, bin, obj, .cache, .parcel-cache, .turbo, .vercel, .output
Default Excluded File Patterns
*.log, *.lock, package-lock.json, yarn.lock, pnpm-lock.yaml, *.min.js, *.min.css, *.map, *.pyc, *.class, *.exe, *.dll, *.png, *.jpg, *.gif, *.svg, *.pdf, *.zip, *.woff, *.woff2, *.ttf … and more
Packaging for the Marketplace
npm install -g @vscode/vsce
vsce package
# Produces: project-structure-finder-1.0.0.vsix
Install locally:
code --install-extension project-structure-finder-1.0.0.vsix
Publish to Marketplace:
vsce publish
Note: You need a Personal Access Token from Azure DevOps and a publisher account.
Project Structure
project-structure-finder/
├── src/
│ ├── extension.ts # Activation, command registration, lifecycle
│ ├── treeDataProvider.ts # VS Code TreeDataProvider (sidebar rendering)
│ ├── stateManager.ts # Checkbox state, toggles, global flags
│ ├── fileSystemScanner.ts # Async directory traversal & pattern matching
│ ├── outputGenerator.ts # Text file builder (tree + file contents)
│ ├── types.ts # Shared TypeScript interfaces & enums
│ └── constants.ts # Command IDs, config keys, binary extensions
├── media/
│ └── icon.svg # Activity bar icon
├── .vscode/
│ ├── launch.json # F5 debug configuration
│ └── tasks.json # Background TypeScript watch task
├── package.json # Extension manifest & contributions
├── tsconfig.json # TypeScript compiler settings
├── .eslintrc.json # Linting rules
├── .vscodeignore # Files excluded from VSIX package
└── README.md
Architecture
extension.ts (activate)
│
├── StateManager ← single source of truth for tree state
│ ├── rootNodes[] ← FileSystemNode tree
│ ├── includeContents ← global toggle
│ └── onStateChanged ← EventEmitter
│
├── ProjectStructureTreeProvider ← reads StateManager, drives TreeView
│
├── fileSystemScanner ← pure async fs logic, no VS Code deps
│
└── outputGenerator ← pure file writer, no VS Code deps
License
MIT