M4.4: Git gutter change markers and status colours in tree and tabs
- git.lineChanges {id} -> {ranges: [{kind, startLine, endLine}], version}:
the buffer against its index blob, line diff with similar (Myers +
Replace, no Compact) off the lock, CRLF-safe; index texts cached per
path and dropped on gitChanged (State::emit -> git_lines::observe)
- editor gutter markers for added, modified and deleted lines, queried
150 ms after edits, on show and on gitChanged, mapped through edits
- vcsStatus store (git.status on projectOpened and gitChanged, no
polling) colouring file names in the project tree and editor tabs with
the --lt-vcs-* tokens; contrast also checked on the active tab
- tests: unit and property tests, real-repo engine tests, Vitest
- docs: architecture, parity, gaps, roadmap, ui-parity, ROADMAP
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
56dadc91dc
commit
fc8ae6c2e3
24 changed files with 1970 additions and 20 deletions
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Tests for the Project tool window: empty state, lazy expansion, keyboard
|
||||
* navigation, refresh on `TreeChanged`, error display and the truncated
|
||||
* listing note. The engine is
|
||||
* navigation, refresh on `TreeChanged`, error display, the truncated
|
||||
* listing note and Git status colours (M4.4). The engine is
|
||||
* mocked: `invoke` answers `project.children` from an in-memory folder and
|
||||
* events go through the local dispatcher in `engineEvents.ts`.
|
||||
*/
|
||||
|
|
@ -15,6 +15,7 @@ vi.mock("@tauri-apps/api/core", () => ({ invoke }));
|
|||
import { emitEngineEvent } from "../../src/components/project/engineEvents";
|
||||
import ProjectToolWindow from "../../src/components/project/ProjectToolWindow.vue";
|
||||
import { useProjectStore } from "../../src/stores/project";
|
||||
import { useVcsStatusStore } from "../../src/stores/vcsStatus";
|
||||
import { t } from "../../src/i18n";
|
||||
|
||||
/** An entry as the engine's `project.children` returns it. */
|
||||
|
|
@ -267,4 +268,28 @@ describe("ProjectToolWindow", () => {
|
|||
emitEngineEvent({ kind: "projectOpened", root: "/tmp/other", name: "other" });
|
||||
expect(useProjectStore().root).toBeNull();
|
||||
});
|
||||
|
||||
it("colours file names by Git status, and ignored entries inside a repository", async () => {
|
||||
const vcs = useVcsStatusStore();
|
||||
vcs.configure({
|
||||
status: () =>
|
||||
Promise.resolve({
|
||||
ok: true,
|
||||
value: {
|
||||
available: true,
|
||||
repo: { root: "/tmp/demo", detached: false },
|
||||
files: [{ path: "index.php", index: "unmodified", worktree: "modified" }],
|
||||
},
|
||||
}),
|
||||
});
|
||||
const mounted = await mountOpen();
|
||||
wrapper = mounted;
|
||||
await vcs.refresh();
|
||||
await flushPromises();
|
||||
const name = (path: string) => mounted.get(`[data-test=tree-row][data-path="${path}"] .tree__name`);
|
||||
expect(name("index.php").attributes("data-vcs")).toBe("modified");
|
||||
expect(name("index.php").classes()).toContain("tree__name--vcs-modified");
|
||||
expect(name("node_modules").attributes("data-vcs")).toBe("ignored");
|
||||
expect(name("src").attributes("data-vcs")).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue