CleanTimeline is a Visual Studio Code extension that gives you granular control over the editor's Local History for the currently active file. You can remove all Local History entries for a file or selectively delete individual snapshots without touching Git history or workspace files.
The extension operates only on Visual Studio Code's Local History storage directory and never modifies Git history, other source control systems, or workspace files.
- Clean full Local History for current file: Deletes the entire Local History folder that VS Code maintains for the active file.
- Manage snapshots for current file: Lists all Local History snapshots for the active file and lets you delete selected entries.
Open the Command Palette and run:
-
CleanTimeline: Clean Full History for Current File (
cleanTimeline.cleanCurrentFile)- Detects the active file.
- Locates its Local History folder.
- Prompts: "Delete all Local History entries for this file?"
- On confirmation, deletes the corresponding Local History folder and offers to reload the window.
-
CleanTimeline: Manage Local History Snapshots for Current File (
cleanTimeline.manageSnapshots)- Detects the active file.
- Locates its Local History folder.
- Parses
entries.jsonto discover individual snapshots. - Shows a multi-select QuickPick with timestamp, relative age, and snapshot size.
- Deletes only the snapshots you select and updates
entries.jsonaccordingly. - After deletion, offers to reload the window so that VS Code's Local History view reflects the changes.
If the active file has no Local History entries, the extension shows an informational message instead of attempting deletion.
CleanTimeline operates directly on the files and metadata stored in VS Code's Local History directory, but it does not control how or when the built-in Local History / Timeline view refreshes its internal state.
- When you add new snapshots, VS Code may show them in its Local History UI without a reload because that behavior is implemented internally by the editor.
- When you delete snapshots with CleanTimeline, the underlying snapshot files and
entries.jsonare updated immediately, but VS Code's Local History view does not reliably notice these external changes. - In practice, this means that deleted entries can continue to appear in the Local History / Timeline view until you reload the window.
For accurate Local History UI after using CleanTimeline:
- Use the provided Reload Window prompt after cleaning all history or deleting selected snapshots, or
- Manually run the
Developer: Reload Windowcommand from the Command Palette.
- Local History only: All operations are restricted to VS Code's Local History storage:
- macOS:
~/Library/Application Support/Code/User/History - Linux:
~/.config/Code/User/History - Windows:
%APPDATA%/Code/User/History
- macOS:
- No Git or SCM changes: The extension never interacts with Git, any other source control provider, or your workspace files.
- Path validation: Before deleting files or folders, paths are resolved and validated to ensure they live under the Local History root, preventing path traversal.
- Robust error handling:
- Missing Local History folders or
entries.jsonfiles are handled gracefully. - Corrupted JSON and missing snapshot files are silently skipped with logging to the
CleanTimelineoutput channel. - Filesystem errors (including concurrent writes by VS Code) are caught and do not crash the editor.
- Missing Local History folders or
- Clone or copy the
CleanTimelineextension source into a folder. - Open the folder in Visual Studio Code.
- Run
npm installto install dev dependencies.
- In VS Code, press
F5to start a new Extension Development Host. - In the Extension Development Host window:
- Open a workspace and a file that already has Local History entries.
- Use the Command Palette to invoke one of the CleanTimeline commands.
- Compile TypeScript:
npm run compile
- Watch for changes:
npm run watch
The compiled JavaScript is emitted into the dist directory and referenced by package.json as the extension entrypoint.
To package the extension for distribution:
- Install the VS Code Extension Manager if needed:
npm install -g vsce
- From the extension root folder:
vsce package
This produces a .vsix file you can install manually in Visual Studio Code.