GitHub - gabi-a/inline-comments

GitHub

2 min read Original article ↗

Highlight text and attach comments to it — without modifying the file. Comments live in .comments.json at the workspace root. Agents (Claude, via MCP) and you (via the editor or CLI) write to the same store, and the editor updates live.

Why quotes, not line numbers

Comments anchor to the text they quote, not to a line/character offset. Edit above a comment and it follows the prose. Rewrap a paragraph and it still resolves (whitespace is normalized away). Reword the quoted text entirely and the comment degrades to ⚠ stale, pinned at its last known line — it is never silently dropped.

Use

In the editor: select text → ⌥C, or click the gutter + on any line. Reply, edit, resolve, and delete from the thread UI.

From Claude: the MCP server exposes add_comment, list_comments, reply_to_comment, update_comment, resolve_comment, unresolve_comment, delete_comment. Claude's comments show up labelled Claude and appear in an open editor within ~1s.

From a terminal:

node dist/cli.mjs --workspace /path/to/project add \
  --file Chapter2.tex --quote "the exact text" --body "your comment"
node dist/cli.mjs --workspace /path/to/project list --all

Layout

src/anchor.ts     quote -> range resolution   (pure Node)
src/store.ts      .comments.json read/write   (pure Node)
src/extension.ts  Comments API, watcher, commands   <- the only file importing 'vscode'
src/mcp.ts        MCP stdio server
src/cli.ts        CLI

anchor.ts and store.ts must never import vscode — that module only exists inside the extension host, and the MCP server and CLI are plain Node processes.

Develop

npm install
npm run build       # or: npm run watch
npm run typecheck
npm run package     # -> inline-comments-0.1.0.vsix

Settings

Setting Default
inlineComments.file .comments.json Store path, relative to workspace root
inlineComments.author OS username Name recorded on comments you create
inlineComments.showResolved false Show resolved threads in the editor

Known limitation

Reflow re-anchoring collapses whitespace, but not line-comment markers. If you rewrap text that is itself commented out (LaTeX %, //, #), the rewrap inserts a marker mid-quote and the comment goes stale rather than re-anchoring. Rewrapping ordinary prose is unaffected.