Virtual File Tree README
A VS Code extension that lets you build custom, task-focused file trees without moving any files on disk.
Features
- Virtual Folders & Files: create folders and add files by path. Drag and drop from the native Explorer. Right-click any file to add it to a virtual folder.
- Group Open Tabs: bundle all open editor tabs into a new virtual folder with one command.
- Profiles: switch between separate workspace setups (e.g., "Frontend", "Bug 402"). Profiles can be shared (committed to Git) or local (tied to your current branch and gitignored).
- Self-Healing Paths: if you rename or move a physical file, the extension updates the virtual links automatically.
- Conflict Resolution: broken links turn red. Right-click to find a new path or bulk-clean missing files.
- Smart Folders: dynamic folders that update in real time:
- Glob patterns (e.g.,
**/*.test.ts)
- Git Changes (modified, added, untracked files)
- Recent Files (your most recently used files)
- Dependency Engine: right-click a file and choose Generate Dependency Tree… to create a folder containing:
- Upstream: files the target imports
- Downstream: files that import the target
- Both
Works with any language that has an active language server.
- Extension API: other extensions can register custom upstream providers for languages the built‑in scanner doesn't cover.
Requirements
- VS Code 1.74.0 or later.
- For the Dependency Engine, the relevant language server extension should be installed (e.g., Pylance (Python), rust-analyzer, or the built-in TypeScript language features).
Getting Started
- Install the extension.
- Open any workspace. The Virtual File Tree view appears in the Activity Bar.
- Add files to virtual folders: use the Explorer context menu, the editor tab context menu, or the Command Palette. You can also drag files from the native Explorer into a virtual folder.
- Group your open tabs into a new virtual folder through the Command Palette or by right‑clicking a folder in the virtual file tree.
- Generate a dependency tree for any file: available from the Explorer context menu, the editor tab context menu, the virtual file tree context menu, or the Command Palette. Choose upstream, downstream, or both.
- Explore more options based on the set of features listed above.
Extension Settings
This extension does not contribute any VS Code settings at this time.
API
To register a custom upstream dependency provider for a specific language:
import * as vscode from 'vscode';
export async function activate() {
const vt = vscode.extensions.getExtension('hjdesulme.virtual-file-tree');
const api = vt.isActive ? vt.exports : await vt.activate();
api.registerUpstreamProvider('myLang', {
getUpstreamDependencies: async (uri: vscode.Uri) => {
// return an array of vscode.Uri that this file depends on
return [vscode.Uri.file('/path/to/dep')];
}
});
}
Known Issues
- The Dependency Engine relies on language server responsiveness; on very large projects it may time out gracefully.
- Dynamic imports and some less common languages may not be detected by the fallback scanner. Use the API to fill gaps.
Release Notes
1.0.2
- Bug Fix: The Dependency Engine now correctly ignores local third-party directories (
node_modules, .venv, etc.) and build outputs (dist, out) from being generated in the tree.
1.0.1
- Lowered the minimum VS Code version requirement from
1.120.0 to 1.74.0 to improve backward compatibility.
1.0.0
- Initial release with the full Virtual File Tree feature set: virtual folders, profiles, smart folders, dependency engine, and the upstream‑provider API.
Feedback & Contributing
Found a gap in the dependency scanner? Have an idea for a new smart folder type? Have another bug, feature idea, or improvement? Issues and pull requests are highly encouraged.
- Reporting Issues: If a specific language's imports aren't being caught, please include a tiny code snippet of the syntax so we can add it to the fallback scanner.
- Pull Requests:
- Extending the Scanner: A good PR includes the new import keyword(s) and a short test snippet.
- Custom Providers: If you're building a full custom provider extension, the API section above has exactly what you need.
Roadmap
v1.1.0: Code quality improvements
Focusing on internals (i.e., refactoring): cleaning up the architecture and making the codebase easier to contribute to. This is comprised of splitting the profile and smart folder logic into their own dedicated services, and replacing a bunch of any types with proper TypeScript types. No new user-facing features.
License
MIT – see LICENSE for details.
| |