Skip to content

enegalan/cleantimeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CleanTimeline

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.

Features

  • 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.

Commands

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.json to discover individual snapshots.
    • Shows a multi-select QuickPick with timestamp, relative age, and snapshot size.
    • Deletes only the snapshots you select and updates entries.json accordingly.
    • 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.

Local History view limitations

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.json are 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 Window command from the Command Palette.

Safety Guarantees

  • 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
  • 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.json files are handled gracefully.
    • Corrupted JSON and missing snapshot files are silently skipped with logging to the CleanTimeline output channel.
    • Filesystem errors (including concurrent writes by VS Code) are caught and do not crash the editor.

Installation (Development)

  1. Clone or copy the CleanTimeline extension source into a folder.
  2. Open the folder in Visual Studio Code.
  3. Run npm install to install dev dependencies.

Running the Extension

  1. In VS Code, press F5 to start a new Extension Development Host.
  2. 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.

Building

  • 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.

Packaging (Optional)

To package the extension for distribution:

  1. Install the VS Code Extension Manager if needed:
    • npm install -g vsce
  2. From the extension root folder:
    • vsce package

This produces a .vsix file you can install manually in Visual Studio Code.

About

CleanTimeline is a Visual Studio Code extension that provides granular control over Local History. Delete full timeline entries or individual snapshots for the active file safely and efficiently.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors