Code Explainer NotesCode Explainer Notes lets you attach explanations to code selections in VS Code without changing the source files. Use it to document tricky code, leave review notes for yourself, onboard into an unfamiliar project, or keep temporary explanations next to the code while you work. Features
Usage
You can also open the Code Explainer activity bar view to browse comments grouped by file. Use the view's search button to match explanation text or file paths. The filter button limits notes to a file or to linked or pending anchors; the clear button restores all notes. Selecting a linked note opens its source location. Search results update after notes are edited, moved, relinked, or deleted. After confirming a deletion, choose Undo in the notification to restore the note. The Undo action is available while that notification is open; dismissing it completes the deletion. If another note has taken the same ID, restoration stops instead of overwriting it. The editor saves unsaved text as a local workspace draft. Closing its tab keeps the draft; reopening an explanation offers to resume or discard it. Cancel asks before discarding changed text. Drafts are cleared only after a successful save or explicit discard. The preview renders Markdown without raw HTML or remote images; it supports the same basic paragraphs, lists, code, and links as the hover. Display and ShortcutsThe settings With code selected, press Ctrl+Alt+N (Cmd+Alt+N on macOS) to add a note. Press Ctrl+Alt+O (Cmd+Alt+O on macOS) with the cursor on annotated code to open a note, choosing one when several overlap. These bindings can be remapped in VS Code's Keyboard Shortcuts settings. Storage and PrivacyRun Code Explainer: Select Storage Mode to choose where notes live. The
Both modes keep file paths, ranges, IDs, and timestamps. The selected code and note text remain readable in either mode. Context hashes reduce neighboring code in the shared file; they are not encryption and short lines can be guessed. The shared JSON may be committed to Git. Review it before sharing the repository. By default, the extension does not send code or notes to an external service. Optional AI assistance can send explicitly approved text to a model provider selected in VS Code. Changing the mode copies and validates notes at the destination before removing the old file. IDs, explanations, creation dates, and anchors are preserved. Previously saved plain context becomes a hash when moved to shared storage and cannot be reconstructed from that hash later. If the extension starts in personal mode and finds an older shared file, it migrates those notes automatically. In a workspace with multiple folders, each folder has its own file at this path. Notes only appear for files inside their owning folder, and the sidebar groups notes by workspace folder. Adding or removing folders updates the view. Renaming or moving files through VS Code updates their note paths, including moves between workspace folders. If a cross-folder save fails midway, rerunning the move is safe: the destination copy is checked before the source is removed. The extension reloads the active JSON file before each change and uses a temporary
Use Code Explainer: Export Notes to save a versioned JSON archive for one workspace folder. Code Explainer: Import Notes reads an archive, validates every note, and lets you choose the destination folder. Before import, it shows counts of new notes, duplicates, and conflicts. Only new notes are added; duplicates and conflicting IDs are skipped, and existing notes are never overwritten. If notes change between preview and confirmation, import stops and you can retry. Imported paths remain relative to the destination folder; use Relink Explanation if a source file is absent. The archive contains note text, selected code, and anchor context, so review it before sharing. Optional AI Assistance
Generation sends only the selected code and its language ID. Rephrasing sends only the chosen explanation. Neither command sends the file path, whole file, neighboring code, other notes, workspace JSON, or local drafts. Input is limited to 20,000 characters. The provider may apply its own usage limits and data policies; review those before approving a request. The extension never starts an AI request automatically or records prompts or responses in logs. The result opens in the editable Markdown panel. Review and change it before clicking Save; canceling does not create or alter a note. A draft is kept if saving fails or the source changes during review. The extension stores no API key because it uses VS Code's Language Model API. Explanation FormatExplanations are stored as plain text. You can write Markdown-style text such as:
Hover rendering uses VS Code Markdown support. CodeLens display remains line-based. For performance checks, run If a note can no longer be located in its source file, it appears under À rattacher in the Comments view. Open it there to read or edit the explanation. To attach it again, select the new code in an editor and choose Relink Explanation to Selection from the note's context menu. The explanation and its original creation date are kept. Current Limits
DevelopmentInstall dependencies:
Compile:
Compilation type-checks the sources and bundles runtime dependencies into
Run unit tests with Run lint and tests:
The CI runs lint, compilation, unit tests, and the VS Code integration suite on
every pull request. It runs the same checks on pushes to Manual extension test
|