M4.7: blame annotations in the editor gutter
- crates/vcs: blame.rs (git blame --porcelain, --contents - from a
buffer, revisions, untracked files and empty repositories give no
lines; property-tested parser, ISO dates without a date crate)
- engine: git.blame {path, rev?} -> {lines, version} through start_with;
an open buffer is blamed as it would be saved (line ending, BOM)
- ui: blame.ts gutter toggled per file (vcs.toggleBlame, Git menu, no
shortcut), date + author per run, bar coloured by age from tokens,
hover card with the full commit message, click opens the commit in
the Log (vcs.showCommit); refreshed on edits and gitChanged
- docs: architecture "Blame (M4.7)"
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
dc4a00ea0b
commit
2f758d76b9
18 changed files with 2003 additions and 3 deletions
|
|
@ -20,7 +20,9 @@
|
|||
* `git.status`; the tree colours its ignored entries itself while a
|
||||
* repository is open.
|
||||
* - **Gutters:** every `gitChanged` also asks the editors' change markers
|
||||
* to refresh (`refreshGitGutters`), since the index may have changed.
|
||||
* to refresh (`refreshGitGutters`), since the index may have changed,
|
||||
* and the blame annotations (`refreshBlame`); a project change hides
|
||||
* them (`clearBlame`).
|
||||
* - **Lifetime:** {@link start} / {@link stop} are counted, so `App.vue`
|
||||
* and the main layout can both hold the store; the subscription ends
|
||||
* with the last holder.
|
||||
|
|
@ -28,6 +30,7 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { computed, ref, shallowRef } from "vue";
|
||||
import { onEngineEvent, runWaiting, type EngineEventPayload } from "../ipc";
|
||||
import { clearBlame, refreshBlame } from "../components/editor/blame";
|
||||
import { refreshGitGutters } from "../components/editor/gitGutter";
|
||||
|
||||
/** Most files kept from one status. */
|
||||
|
|
@ -387,14 +390,17 @@ export const useVcsStatusStore = defineStore("vcsStatus", () => {
|
|||
switch (event.kind) {
|
||||
case "projectOpened":
|
||||
clear();
|
||||
clearBlame();
|
||||
void refresh();
|
||||
break;
|
||||
case "projectClosed":
|
||||
clear();
|
||||
clearBlame();
|
||||
break;
|
||||
case "gitChanged":
|
||||
void refresh();
|
||||
refreshGitGutters();
|
||||
refreshBlame();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue