Structure Generator
A Visual Studio Code extension that helps you generate and visualize your workspace's directory structure based on customizable include and exclude patterns.
Features
- Directory Structure Generation: Create a clear, textual representation of your project's directory structure in seconds.
- Customizable Filters: Use flexible include and exclude patterns to control which files and directories are shown.
- Display Include/Exclude Patterns: Optionally show the include and exclude patterns at the top of the generated structure for easy reference (can be disabled via settings).
- High Performance: Optimized for handling even large projects quickly and efficiently.
Installation
You can install Structure Generator via the Visual Studio Code Marketplace, or by searching for "Structure Generator" within the VS Code Extensions view (Ctrl+Shift+X
or Cmd+Shift+X
on macOS).
Usage
- Open the workspace or folder you want to analyze in VS Code.
- (Optional) Adjust the include and exclude patterns to customize the output:
- Open Settings (
Ctrl + ,
or Cmd + ,
on macOS).
- Navigate to Extensions > Structure Generator.
- Modify the Exclude, Include, and Show Patterns settings as required.
- Open the Command Palette (
Ctrl + Shift + P
or Cmd + Shift + P
on macOS).
- Type
Structure Generator: Generate Project Structure
and press Enter
.
- The generated directory structure will be displayed in a new text document based on your current configuration.
Configuration
You can configure Structure Generator using glob patterns to include or exclude specific files and directories.
Default Exclude & Include Patterns:
"structureGenerator.exclude": [
"node_modules", // Exclude the node_modules directory
"**/.*" // Exclude hidden files and directories
],
"structureGenerator.include": [
"src/**", // Include everything within the "src" directory
"src" // Ensure the "src" directory itself is included
]
Show Patterns
The extension can display the include and exclude patterns at the top of the generated structure. This is controlled by the structureGenerator.showPatterns
setting, which defaults to true
.
You can disable this feature in the settings:
"structureGenerator.showPatterns": false
When enabled, the patterns will be shown in the output as follows:
### Exclude Patterns:
- `node_modules`
- `**/.*`
### Include Patterns:
- `src/**`
- `src`
_You can disable this in `structureGenerator.showPatterns`_
---
Example Output: