mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
Removes selectors that restyled whole subtrees on every inserted editor line or focus change (CodeMirror via a pnpm patch; selectorCost.test.ts guards them), measures space width once per font, shares one tooltip host, builds tab menus lazily, caches parsed SVG icons, prewarms an off-screen editor at idle, stats project-tree entries in parallel, and keeps the Git tool window at its size during a live window resize. Verified with full vitest, typecheck, ide-vfs cargo test and clippy, gitLog e2e, and a window resize in the app.
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import { afterEach, expect, it } from "vitest";
|
|
import { isIgnoredName } from "./ignoredNames";
|
|
import { useProject } from "./project";
|
|
|
|
const initial = useProject.getState();
|
|
afterEach(() => useProject.setState(initial, true));
|
|
|
|
function withNames(ignoredNames: string[]) {
|
|
useProject.setState({ settings: { files: { ignoredNames } } } as never);
|
|
}
|
|
|
|
it("matches the defaults by exact name and by wildcard", () => {
|
|
expect(isIgnoredName(".git")).toBe(true);
|
|
expect(isIgnoredName("module.pyc")).toBe(true);
|
|
expect(isIgnoredName("notes.txt~")).toBe(true);
|
|
expect(isIgnoredName("module.py")).toBe(false);
|
|
expect(isIgnoredName("pyc")).toBe(false);
|
|
});
|
|
|
|
it("anchors every wildcard and keeps other pattern characters literal", () => {
|
|
withNames(["*.log", "build?", "a+b.(x)"]);
|
|
expect(isIgnoredName("server.log")).toBe(true);
|
|
expect(isIgnoredName("server.log.1")).toBe(false);
|
|
expect(isIgnoredName("build1")).toBe(true);
|
|
expect(isIgnoredName("build12")).toBe(false);
|
|
expect(isIgnoredName("a+b.(x)")).toBe(true);
|
|
expect(isIgnoredName("aab.x")).toBe(false);
|
|
});
|
|
|
|
it("follows the setting when it changes, and ignores entries with a path", () => {
|
|
withNames(["dist", "out/*"]);
|
|
expect(isIgnoredName("dist")).toBe(true);
|
|
expect(isIgnoredName(".git")).toBe(false);
|
|
expect(isIgnoredName("out")).toBe(false);
|
|
withNames([]);
|
|
expect(isIgnoredName("dist")).toBe(false);
|
|
});
|