mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-08 08:52:12 +00:00
Project & files - Project view modes (Project Files / Open Files / All Changed Files / Scratches); External Libraries for Python, JDK (src.zip), Node, Cargo, Go, Maven/Gradle jars; read-only jar/zip browsing - ⌘N New popup with type search and more file kinds; New Project, Rename Project, Reload All from Disk, Export/Import Settings, Power Save Mode - File type associations, extra content roots and exclude patterns (indexed and watched without reopening the project) Editor & navigation - Find bar: search scope (comments/strings), Preserve Case, Exclude, multiline, history; Find in Files: Module scope, custom pattern scopes, multiline - Search Everywhere filters, Assign Shortcut, settings results; named bookmark lists, file/folder bookmarks; Structure filters and Show Inherited; Recent Locations timestamps and breadcrumbs; Code Vision author - Completion options, editor tab placement/layout, inline completion (LSP 3.18) - Spell checking (Typo inspection, ide-spell) and Inspections settings with custom profiles; Code Style schemes, formatter markers, Do not format Run, VCS, services, database - Typed run configurations (Shell, Program, npm, Gradle, Maven, Docker, Compound), Modify options, Before launch, env dialog, Current File, Emulate terminal (PTY) - Git log graph/view options, Go to Hash/Branch/Tag, date filter keeps the graph; Pull/Merge/Rebase dialogs, Manage Remotes, Worktrees - Generic Services host (Docker connections/registries, run sessions); TODO scope/changes tabs with changelists; Coverage report import - Data sources: wire-compatible vendors, URL import, SSL certs, Options, Schemas and Advanced tabs, color and comment Workbench - Run Anything, Customize Main Toolbar, named tool window layouts, menu completeness, Code Cleanup, macros, "Don't Show Again", editor banners - Chinese translations for the new UI Claude-Session: https://claude.ai/code/session_01SaPPsVPuk6ZTNsoUCNCbMv
72 lines
2.3 KiB
TypeScript
72 lines
2.3 KiB
TypeScript
import { beforeEach, describe, expect, it } from "vitest";
|
|
import { useProject } from "./project";
|
|
import { projectModules } from "./projectRoots";
|
|
import {
|
|
contextAccepts,
|
|
customScopes,
|
|
findCustomScope,
|
|
rememberSearch,
|
|
saveCustomScopes,
|
|
searchHistory,
|
|
useCustomScopes,
|
|
} from "./search";
|
|
|
|
const openProject = (root: string | null) =>
|
|
useProject.setState({
|
|
project: root ? ({ root, name: "p", isGit: false } as never) : null,
|
|
});
|
|
|
|
describe("shared search pieces", () => {
|
|
beforeEach(() => {
|
|
localStorage.clear();
|
|
useCustomScopes.setState({ root: null, scopes: [] });
|
|
openProject(null);
|
|
});
|
|
|
|
it("search context accepts matches like the backend", () => {
|
|
expect(contextAccepts("any", "comment")).toBe(true);
|
|
expect(contextAccepts("inComments", "comment")).toBe(true);
|
|
expect(contextAccepts("inComments", null)).toBe(false);
|
|
expect(contextAccepts("exceptStringLiterals", "comment")).toBe(true);
|
|
expect(contextAccepts("exceptStringLiterals", "string")).toBe(false);
|
|
expect(contextAccepts("exceptCommentsAndStringLiterals", null)).toBe(true);
|
|
});
|
|
|
|
it("history is shared, newest first and unique", () => {
|
|
rememberSearch("find", "a");
|
|
rememberSearch("find", "b\nc");
|
|
rememberSearch("find", "a");
|
|
expect(searchHistory("find")).toEqual(["a", "b\nc"]);
|
|
});
|
|
|
|
it("custom scopes are saved per project", () => {
|
|
openProject("/p1");
|
|
saveCustomScopes([
|
|
{ name: " Sources ", pattern: " file:src//* " },
|
|
{ name: "", pattern: "x" },
|
|
]);
|
|
expect(customScopes()).toEqual([{ name: "Sources", pattern: "file:src//*" }]);
|
|
openProject("/p2");
|
|
expect(customScopes()).toEqual([]);
|
|
openProject("/p1");
|
|
expect(findCustomScope("Sources")?.pattern).toBe("file:src//*");
|
|
});
|
|
|
|
it("modules are the project and the folders of detected build files", () => {
|
|
const modules = projectModules(
|
|
[
|
|
{ path: "web/src", kind: "source", detectedFrom: "web/package.json" },
|
|
{ path: "src", kind: "source", detectedFrom: "Cargo.toml" },
|
|
{ path: "crates/a/src", kind: "source", detectedFrom: "crates/a/Cargo.toml" },
|
|
{ path: "gen", kind: "excluded", detectedFrom: null },
|
|
],
|
|
"app",
|
|
);
|
|
expect(modules).toEqual([
|
|
{ path: "", name: "app" },
|
|
{ path: "crates/a", name: "a" },
|
|
{ path: "web", name: "web" },
|
|
]);
|
|
});
|
|
});
|