Notes
A native, movable Notes section in the VS Code Explorer. It lists the
Markdown notes of every workspace folder that is a Git repository, read from the
repository's Git history rather than by scanning the working tree.
Notes are the *.md files below the notes/ folder, at any depth:
notes/
2026/
10/
09/
second-note.md
first-note.md
inbox/
idea.md
- A note is discovered by replaying the commits of the current branch. The dated
notes/YYYY/MM/DD/ layout is only a convention (and what New Post writes);
notes/inbox/idea.md is just as valid.
- Notes are sorted by their first commit (creation), newest first; descending
case-sensitive filenames only break ties. A note's creation time survives a
rename: Git's rename detection keeps the original first commit.
- Only committed notes appear. A file that was created or edited outside Git
shows up once it is committed, because the index is derived from history. Use
Save (below) for the edits made in VS Code.
- Click a note to open it in VS Code's built-in Markdown Editor
(
vscode.markdown.editor), not the read-only Markdown Preview. This requires a
VS Code version that includes that editor.
- Right-click a note and choose Save to save its document and commit only
that file to the local Git repository. The message is
保存<filename>文件,
for example 保存1.md文件. Other staged changes are not included, and no push
is performed. Unchanged files do not create empty commits. Git failures are
shown; a failed commit can leave the selected file staged. Git operations use
libgit2, not the Git executable; the author identity is taken from Git config
(user.name / user.email), falling back to Noted <noted@localhost> — which
is then stored in the repository's local config — when none is configured.
Git hooks are not executed. Signed commits are unsupported and Save rejects
commit.gpgsign=true. Finish any merge or rebase before using Save.
- Right-click a note and choose Rename to change its filename within the same
folder (message
保存<new name>文件). Names must end in .md; existing files
are never overwritten. VS Code applies the rename to open documents as well,
and the rename is committed so the note keeps its place in the list.
- Right-click a note and choose Delete to delete that file immediately —
without confirmation, without moving it to Trash, and with a
删除<filename>文件 commit. Repository nodes do not offer this action.
- Use the new-file button next to Refresh (or Notes: New Post) to create an
empty
notes/YYYY/MM/DD/1.md using the local calendar date and commit it as
新建1.md文件. Existing names are skipped (2.md, 3.md, etc.) without
overwriting, and the file opens focused in the built-in Markdown Editor. Select
a repository or one of its notes first; otherwise a multi-root workspace
prompts for a repository. Single-root workspaces use their only repository.
- Drag the Notes section header to reposition it, including the secondary
sidebar. Alternatively, right-click its header and use Move View.
- Drag notes into the editor to open them. Reordering notes or moving files by
dropping them into Notes is intentionally unsupported: sorting is automatic.
- Note creation/deletion refreshes only the affected repository, with event
bursts coalesced over 75 ms. Saving note content does not rescan the list.
The refresh button and Notes: Refresh command clear all cached lists.
- In multi-root workspaces, the first level lists repositories in workspace
order. Expand a repository to load its sorted notes; repositories without
notes remain visible with an empty list. Single-root workspaces show notes
directly. Standard search exclusions do not hide notes.
- Folders that are not Git repositories show an empty list; initialize a
repository (this extension does not do that) to use the view.
The index
Reading notes from history needs an index, so the extension keeps a small SQLite
database next to the repository's Git metadata
(<repository>/.git/notes-index.sqlite) — nothing is written into the working
tree, and the repository stays self-contained. For every note it stores a stable
id, the first commit (creation), the last commit (modification), the blob size
and both commit ids, plus a row per replayed commit and every revision that
touched a note (note_history, linked by that id so it survives renames).
- Cache key. A repository is up to date exactly when every commit reachable
from
HEAD has been replayed, remembered as indexedHead. Nothing changes →
the list comes straight from the cache. HEAD moved → only the missing commits
are replayed (the replayed ones are hidden from the revision walk). A branch
that was rewritten (rebase, amend, reset) cannot be reached from the recorded
tip, so the cache is rebuilt from scratch.
- First run on an old repository may replay a long history. The Notes view
then shows a Building index… row with
done/total commits progress while
the replay runs in the background in chunks of 400 commits; the tree refreshes
itself as soon as the index is complete.
- The index is a pure cache: delete the file and it is rebuilt on the next
expansion. It never touches tracked files, so it cannot dirty the repository.
Development
The implementation has two layers:
packages/rust-notes-core: Git-history indexing (libgit2) and the SQLite
cache, note path validation, file operations and single-note commits, a JSON
C ABI for the iOS app and the JSON dispatcher used here.
apps/notes-vscode: the Node-API binding (native/ + src/core.cjs), tree
presentation (including the indexing progress node), cache/watch refresh,
prompts and VS Code document integration. Rename is validated in Rust and
applied using WorkspaceEdit so open documents follow the new filename, then
committed through Rust.
Install the pnpm workspace dependencies from the monorepo root. Development and
packaging require Rust/Cargo and a C/C++ compiler. Only filesystem repositories
on the extension host are supported, not virtual workspace filesystem providers.
Open this extension folder in VS Code and run Run Notes with F5. In the
Extension Development Host, open a Git repository containing committed Markdown
files under notes/. The launch task builds the native addon and extension
bundle first.
pnpm run build
pnpm test
pnpm run check
pnpm run package
Packaging uses the monorepo's existing esbuild and @vscode/vsce tools. The
bundle includes the Node wrapper and native addon, with no workspace symlink or
node_modules dependency at runtime. A platform-specific VSIX is built for the
current host (for example darwin-arm64); build on each target OS/CPU separately.
Installed users need neither Rust nor the Git executable. Install the generated
VSIX with Extensions: Install from VSIX....
Releasing
.github/workflows/notes-vscode-bump-version.yml (notes-vscode - Bump Version)
bumps the version in package.json (the native addon's Cargo version is
independent and stays untouched). On master it pushes
bump/notes-vscode-v<version> and opens a PR; on any other branch it commits
straight to that branch.
gh workflow run "notes-vscode - Bump Version" --ref master -f bump_type=minor
.github/workflows/notes-vscode-publish.yml (notes-vscode - Publish) then
uploads one platform-specific VSIX per host via vsce publish, which runs
vscode:prepublish (build + check + test) first. Because the extension ships a
Node-API addon, publishing must run on the target OS/CPU — pick the runner
input (self-hosted default, or macos-latest).