Skip to content
| Marketplace
Sign in
Visual Studio Code>SCM Providers>Annotate with Git Blame (PyCharm style)New to Visual Studio Code? Get it now.
Annotate with Git Blame (PyCharm style)

Annotate with Git Blame (PyCharm style)

Thongvan Alexis

|
1 install
| (0) | Free
Right click, Annotate with Git Blame: authors and dates in a margin left of the code, like PyCharm. Nothing else.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Annotate with Git Blame for VS Code

PyCharm's "Annotate with Git Blame" in VS Code, and nothing else: authors and dates in a margin to the left of the code, highlighting of the lines from the same commit on hover, and the commit message in a popup.

No account, no network, no telemetry, no AI, no side view and no status bar item. The only dependency is VS Code's built-in Git extension (vscode.git), and the extension works even without it.

Install

Requirements: VS Code 1.109 or later, Git, Node.js, and the code command on the PATH (VS Code installs it by default on Windows).

cd vscode-annotate-blame
npm install            # once: fetches the build tools
npm run install-local  # checks, builds, creates annotate-blame.vsix and installs it in VS Code

Then, in VS Code: Ctrl+Shift+P then Developer: Reload Window, or close and reopen VS Code.

Without the command line: Extensions view (Ctrl+Shift+X), … menu at the top, Install from VSIX…, then pick annotate-blame.vsix (created by npm run package).

  • Update after changing the code: run npm run install-local again.
  • Uninstall: code --uninstall-extension ThongvanAlexis.annotate-blame, or the Uninstall button in the Extensions view.

Use

Action Effect
Right-click in the code or on the line numbers → Annotate with Git Blame shows the margin (files tracked by git only)
Mouse resting on a line, code or margin highlights every line of that line's commit
Mouse resting on a name in the margin also shows a tooltip: short hash, author, date, first line of the message
Click on a name also highlights the lines of that commit
Double-click on a name commit popup: short hash, author, date, then the full message exactly as it was written
Right-click → Show Commit Message the same popup, for the clicked line (works on every line)
Show commit message link in the tooltip the same popup
Right-click → Disable Annotate, or Esc removes the margin, the code moves back into place

The three commands are also in the Command Palette (Ctrl+Shift+P, "Git Blame").

  • The margin: author name (cut with "…" when too long) and short date YYYY-MM-DD, in the theme's line number color. It has a fixed width, so the code stays aligned.
  • Uncommitted lines (changed in the editor or on disk): "Not committed", in a paler color. A typed line switches to "Not committed" right away; git is queried again 0.6 s after the last keystroke, on save, and after a commit or a checkout.
  • The popup has four buttons: Copy Hash (full hash), Copy Message, View Diff (what this commit changed in this file) and Close (Esc closes it too).
  • Per file: annotating one file does not annotate the others. The same file open in two editors side by side is annotated in both.
  • Esc first does what it already does in VS Code: close a tooltip, a notification, the search box, the autocompletion, or cancel a selection. It removes the margin when it has nothing else to do.

Settings

Ctrl+, then search for "Annotate with Git Blame".

Setting Default Purpose
blameAnnotate.width 26 margin width in characters, author and date included (4 to 80)
blameAnnotate.showDate true show the date after the author
blameAnnotate.labelEveryLine true name on every line; false: only on the first line of each block from the same commit
blameAnnotate.hoverTooltip true tooltip when hovering the margin (highlighting still works without it)

Colors can be changed in workbench.colorCustomizations: blameAnnotate.marginForeground, blameAnnotate.uncommittedForeground, blameAnnotate.marginBackground, blameAnnotate.highlightBackground, blameAnnotate.highlightOverviewRuler.

Limitations and chosen fallbacks

VS Code gives extensions neither a hover event nor a double-click event on a decoration. Both were checked in a real VS Code 1.148 before anything else was built (details in docs/01-vscode-api.md).

  • Hover: done, on the code as well as on the margin. It goes through the tooltip mechanism, so it only reacts after the editor.hover.delay delay (300 ms by default), and only when the mouse stops over text. There is no "mouse leaves" event: in the empty space after the end of a line, or outside the editor, the highlight stays on the last hovered line. It clears when the cursor moves. The tooltip also appears on the first character of a non-indented line of code, which VS Code cannot tell apart from the margin.
  • Double-click: done, except on two kinds of lines. It does not work on empty lines or on lines that start with a symbol (#, @, ), }, """…). VS Code then reports nothing to the extension. Chosen fallback: on every line, right-click → Show Commit Message, or the Show commit message link in the tooltip.
  • Popup: VS Code's modal dialog. The message is shown as plain text, line breaks preserved, with no Markdown rendering. Its look depends on a VS Code setting that an extension cannot choose:
    • by default on Windows (window.dialogStyle: native), it is a Windows dialog: it does not scroll, and its text cannot be selected with the mouse. The Copy Message and Copy Hash buttons are there for that;
    • with "window.dialogStyle": "custom" in the VS Code settings, the dialog takes VS Code's look and the theme colors, scrolls, and its text can be selected. This setting changes every dialog in VS Code.

Develop

npm run check             # type checking + unit tests (vitest)
npm run test:integration  # starts a separate VS Code instance and drives it with the mouse
npm run watch             # rebuilds on every change

F5 in VS Code opens a second window with the extension loaded from the sources.

npm run test:integration builds a small test git repository in .vscode-test\fixture repo\, opens the installed VS Code on it with a throwaway profile, then sends real mouse and keyboard events to that window only (DevTools protocol: the machine's pointer does not move). To also compare every line of a real file with git blame:

$env:BLAME_ANNOTATE_CHECK_FILE = 'C:\projects\my-repo\src\app.py'
npm run test:integration

Documentation

These documents are in French.

  • BRIEF.md: the requirements
  • docs/01-vscode-api.md: what VS Code allows, the spike results and the workarounds
  • docs/02-architecture.md: code organization
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft