Code Bookmarks is a premium, lightweight, zero-dependency VS Code extension that lets you bookmark lines of code with custom, readable labels. Instantly jump to bookmarked lines from a dedicated sidebar panel, and enjoy dynamic tracking that prevents bookmarks from drifting when you edit your code.
Features
🔖 Line Bookmarking: Toggle bookmarks on any line instantly using a keybinding, context menu, or command.
🏷️ Custom Labels: Give your bookmarks readable, clear descriptions (e.g. "Fix this loop bug", "API Entry Point") instead of just showing the filename and line number.
🧭 Activity Bar & Sidebar Panel: An interactive tree view showing your custom nested bookmark hierarchy. Click any bookmark to jump to its file and line.
🔀 Drag & Drop Reorganization: Drag and drop bookmarks to create nested hierarchies of any depth. Drag a bookmark onto another to nest it, or drop it between them to reorder.
⚡ Dynamic Line Shift Tracking: Edits to files (adding/removing lines) are tracked in real-time, shifting your bookmarks (including all nested sub-bookmarks) automatically so they always point to the correct code line!
🎨 Premium Styling:
Gutter icons with modern indigo gradients to mark bookmarked lines.
Subtle background line highlighting.
Interactive tooltips showing code previews using markdown.
🔔 Status Bar Indicator: Displays the total count of bookmarks in the workspace; click it to quickly show the Bookmarks panel.
📂 Workspace Persistence: Bookmarks are saved per-workspace, so your bookmarks remain isolated to the project you are working on.
Keyboard Shortcuts
Command
Shortcut (Windows/Linux)
Shortcut (macOS)
Toggle Bookmark
Ctrl + Alt + B
Cmd + Alt + B
Add Bookmark with Label
Run from Command Palette
Run from Command Palette
Interactive Controls
Sidebar Tree View
Drag & Drop: Drag a bookmark and drop it onto another. An elegant prompt will let you choose to:
Add Inside: Make it a child of the target bookmark.
Move Before: Insert it immediately before the target bookmark (at the same level).
Move After: Insert it immediately after the target bookmark (at the same level).
Note: Dropping on empty space moves the bookmark back to the root level. Built-in checks prevent cycle nesting.
Click: Opens the file and scrolls to the bookmarked line.
Hover: Shows a tooltip preview of the file path and the bookmarked line's code snippet.
Hover inline actions:
✏️ Edit Bookmark Label: Rename your bookmark.
🗑️ Delete Bookmark: Delete individual bookmarks (and any of their nested children).
Right-Click Menu: Access commands to edit or delete.
View Header Actions (Top-Right):
🔄 Refresh Bookmarks: Force refresh the list.
🧹 Clear All Bookmarks: Confirm and delete all bookmarks in the workspace.
Development & Debugging
Since this extension has no compile step and no external npm dependencies, you can run and debug it instantly in VS Code.
How to Run
Open this folder (code-bookmarks) in a new VS Code window.
Open extension.js or press Ctrl+Shift+D to go to the Run and Debug side menu.
Click the Run Extension green play button (or press F5).
A new window ([Extension Development Host]) will open.
In the new window, open any codebase/folder, open a file, and press Ctrl+Alt+B (or Cmd+Alt+B on Mac) to start bookmarking!