Switch between predefined file filter views in VS Code Explorer. Focus on different parts of your codebase by dynamically showing/hiding folders and files.
- Quick View Switching: Use Command Palette to instantly switch between configured views
- Workspace-Specific: Define different views for each project in workspace settings
- No Window Reload: View changes happen instantly without disrupting your workflow, terminals, or coding agent sessions
- Gitignore Integration: Automatically apply patterns from .gitignore file to any view
- Coding-Agent-Friendly: Views are stored in
.vscode/settings.json, making them easy for coding agents to read and modify
-
First Time Setup:
- Open Command Palette (
Ctrl+Shift+PorCmd+Shift+P) - Type "Switch File View" and press Enter
- Click "Add Examples" to create starter views in your workspace settings
- Open Command Palette (
-
Switching Views:
- Open Command Palette
- Type "Switch File View"
- Select the view you want to activate
-
Customizing Views:
- Open workspace settings (
.vscode/settings.json) - Modify the
explorerViews.viewsarray - Each view has a
nameandfiltersobject
- Open workspace settings (
Add this to your .vscode/settings.json:
{
"explorerViews.views": [
{
"name": "Full View",
"filters": {}
},
{
"name": "Hide Dependencies",
"gitignore": true,
"filters": {
"**/node_modules": true,
"**/dist": true,
"**/out": true,
"**/.git": true
}
},
{
"name": "Frontend Focus",
"filters": {
"**/backend": true,
"**/api": true,
"**/node_modules": true,
"**/.git": true
}
},
{
"name": "Backend Focus",
"filters": {
"**/frontend": true,
"**/public": true,
"**/node_modules": true,
"**/.git": true
}
}
]
}The extension updates the files.exclude workspace setting when you switch views. Patterns set to true are hidden from the Explorer.
When you enable "gitignore": true on a view, the extension:
- Reads your workspace's
.gitignorefile - Converts gitignore patterns to VS Code glob patterns
- Merges them with your custom filters (custom filters take precedence)
- Applies the combined filters to the Explorer
This is useful for automatically hiding all files and folders that are already ignored by git, without having to manually duplicate those patterns in your view configuration.
- Create project-specific views based on your actual folder structure
- Use glob patterns like
**/to match at any depth - Leave
filtersempty ({}) for a "show everything" view - Enable
"gitignore": trueto automatically hide gitignored files - Ask your coding agent to create or modify views for you!
This extension contributes the following settings:
explorerViews.views: Array of view definitions with name and filters
# Compile TypeScript
npm run compile
# Watch mode (auto-compile on changes)
npm run watch
# Run linter
npm run lint
# Run tests
npm test- Press F5 to launch the Extension Development Host (separate VS Code window)
- In that window, press
Ctrl+Shift+P(orCmd+Shift+Pon Mac) - Type "Switch File View" and press Enter
- If no views are configured, click "Add Examples" to create starter views
- Select a view to test the filtering
After making code changes, reload the Extension Development Host with Ctrl+R (or Cmd+R).
Entry Point: src/extension.ts
The main extension file:
- Registers the
explorer-views.switchViewcommand - Reads views from
explorerViews.viewsworkspace setting - Shows QuickPick UI with view names
- Updates
files.excludesetting with selected view's filters
Configuration Schema: package.json under contributes.configuration defines the explorerViews.views array schema.
**/node_modules: Match node_modules at any depth**/dist: Match dist folder anywhere**/*.map: Match all .map files**/.git: Match .git directory- Use
**/prefix to match at any directory level
To package and publish:
# Install vsce globally
npm install -g @vscode/vsce
# Package as .vsix file
vsce package
# Publish to marketplace (requires publisher account)
vsce publishUpdate version in package.json before publishing.
Enjoy!