Overview
/ Scope
- VS Code extension API integration
- Strict tree schema & parser
- Preview webview before filesystem write
- Conflict-aware file system writer
- Marketplace release & version management
Highlights
01
Preview-first file tree generation — see before you write
02
Conflict-aware writes — existing files never silently overwritten
03
36,000+ installs, 5.0 rating on VS Code Marketplace
04
Strict schema validation with clear, actionable error messages
/ Tracks
- Product
- Open source
Media
External preview
Open linkmarketplace.visualstudio.com
FileTree Pro on VS Code Marketplace — 36k+ installs, 5.0 rating
The Problem
Approach
Key Decisions
- 01
Reject over guess
Output must match a known tree structure. When it doesn't, the extension fails with a clear error instead of guessing at the user's intent and generating something half-right. A wrong guess that half-writes a directory is worse than no output at all. - 02
Preview before write
A webview renders the tree before any filesystem change happens. Eliminates 'oops I just overwrote my components/' moments in real repos. - 03
Small command surface, on purpose
The whole workflow is generate, preview, apply — so the command palette only needs to expose those steps, not a menu of configuration options standing in for features that don't exist yet. - 04
Service container instead of one big extension.ts
A small dependency-injection container wires together the tree builder, file-system service, exclusion service, and formatters, instead of instantiating everything inline in the extension's activation function. Makes each piece independently testable — the 243-test suite mocks the VS Code API at the boundary and tests real business logic underneath, not stubs. - 05
Formatter strategy pattern for output
Four output formats (ASCII, Markdown, JSON, SVG) share one interface behind a factory. Adding a fifth format means writing one new class, not touching the four existing ones. - 06
Cache the scan, not the tree
The preview-then-apply workflow means the same folder often gets scanned more than once in a session — preview, tweak, preview again. An LRU cache sits behind the file-system scan so repeated previews of the same folder don't re-walk the disk each time. - 07
Exclusions as their own service, not inline filtering
Glob-based ignore patterns live in a dedicated exclusion service, wired through the same DI container as the tree builder and file-system service — not scattered as inline filtering checks. One place to reason about what gets excluded and why.
Challenges & How I Solved Them
Robust parsing of noisy input
/ Problem
/ Solution
Preserving existing workspace files
/ Problem
/ Solution
Outcomes
- 36,000+ installs on the VS Code Marketplace
- 5.0 average rating across active reviews
- Steady organic adoption — no promotion, just the listing
- 243 passing tests across the suite, covering the tree builder, formatters, security validation, and caching
- Zero reported 'silent overwrite' incidents since conflict-awareness shipped
What I Learned
- 01
Utilities that respect the user's existing work build more trust than utilities with more features.
- 02
Strict validation is a feature, not a limitation, when anything can write to the workspace.
- 03
Marketplace success tracks directly to clarity in the listing — title, screenshots, and a one-line description of what it does.
Tech Stack
Next Steps
- Reusable project-shape presets (save and recall a tree layout)
- Stack-aware defaults (e.g. Next.js vs NestJS layout hints)