Urgent.News

What's breaking now, across thousands of outlets.

Tech

How I Built a Virtual Folder Tree from Flat Filenames — No Files Moved, No Symlinks, Just 300 Lines of TypeScript

I let an AI agent write code in my project for a week. By Friday there were 340 files in one directory. auth_login_handler.ts . auth_login_session.ts . utils_helpers.ts . config_env.ts . All flat. All in the root. The agent loved it. No path ambiguity, no directory hops, no "which folder was that in?" 鈥?every file one read_file call away. Flat is the agent's native habitat. I hated it. Scrolling…

My project grew to 340 files in a single directory. All of them were flat and in the root. The AI agent loved this layout, as it eliminated path ambiguity and made files easily reachable with a single read_file call. However, I found it frustrating to scroll through 340 files to find the specific one I needed. My brain didn't rely on grep, so I decided to create a solution.

I developed a VSCode and IntelliJ plugin called Logical Folders. This plugin displays flat files as a virtual directory tree without moving any files or creating symlinks. The hierarchy is purely visual, keeping the files in their original state on disk. The core of the plugin is a function called parsePath. It splits a filename on a separator and keeps the extension attached to the last segment. For example, auth_login_handler.ts becomes [auth, login, handler.ts].

When you right-click on auth/login/ and create a new handler.ts file, the plugin reassembles the segments into auth_login_handler.ts and writes the flat file back to disk. The virtual tree is a representation of the flat files, not the actual truth of the disk. To build the virtual tree, VSCode's TreeDataProvider interface requires a getChildren(element?) function.

I scanned the entire workspace once, parsed every file path, and inserted them into a tree of LogicalNode objects. This virtual directory tree allows me to navigate the 340 flat files as if they were organized in a hierarchical structure, without actually rearranging the files on my disk.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

What Building 77 Browser-Based Calculators Taught Me About Input Validation

Building one calculator is straightforward. Building dozens of calculators with different units, assumptions, ranges, and failure modes is where input handling becomes the real product.

  • Validate data domain, not just type; enforce range constraints with requireRange utility
  • Convert all units to base unit before computation, convert final result to display unit

More from Sunday 30 August →