дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-08 19:02:17 +02: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
89 рядки
3.1 KiB
TypeScript
89 рядки
3.1 KiB
TypeScript
/**
|
|
* The Services tree host: the root nodes service providers contribute, the
|
|
* selection and expansion, and which provider owns a node.
|
|
*/
|
|
import { create } from "zustand";
|
|
import type { MenuItem } from "@/ui";
|
|
import { serviceProviders, type ServiceProviderContribution, type ServiceTreeItem } from "@/workbench/contributions";
|
|
|
|
/** The service view (Services tool window tab) hosting the tree. */
|
|
export const SERVICES_TREE_VIEW = "services";
|
|
|
|
interface TreeState {
|
|
/** Root nodes per provider id (reported by each provider's `useRoots`). */
|
|
roots: Record<string, ServiceTreeItem[]>;
|
|
selectedKey: string | null;
|
|
expanded: Set<string>;
|
|
}
|
|
|
|
export const useServicesTree = create<TreeState>(() => ({
|
|
roots: {},
|
|
selectedKey: null,
|
|
expanded: new Set(["docker:default", "docker:default:group:containers"]),
|
|
}));
|
|
|
|
export function setProviderRoots(provider: string, items: ServiceTreeItem[]) {
|
|
useServicesTree.setState((s) => (s.roots[provider] === items ? s : { roots: { ...s.roots, [provider]: items } }));
|
|
}
|
|
|
|
export function clearProviderRoots(provider: string) {
|
|
useServicesTree.setState((s) => {
|
|
if (!(provider in s.roots)) return s;
|
|
const roots = { ...s.roots };
|
|
delete roots[provider];
|
|
return { roots };
|
|
});
|
|
}
|
|
|
|
export interface Located {
|
|
item: ServiceTreeItem;
|
|
provider: string;
|
|
}
|
|
|
|
/** Every node by key, with the provider owning it. */
|
|
export function indexTree(roots: Record<string, readonly ServiceTreeItem[]>): Map<string, Located> {
|
|
const out = new Map<string, Located>();
|
|
const visit = (provider: string, item: ServiceTreeItem) => {
|
|
out.set(item.key, { item, provider });
|
|
item.children?.forEach((c) => visit(provider, c));
|
|
};
|
|
for (const [provider, items] of Object.entries(roots)) items.forEach((i) => visit(provider, i));
|
|
return out;
|
|
}
|
|
|
|
/** Roots of all providers, in provider order. */
|
|
export function orderedRoots(
|
|
roots: Record<string, readonly ServiceTreeItem[]>,
|
|
providers: readonly ServiceProviderContribution[],
|
|
): ServiceTreeItem[] {
|
|
return providers.flatMap((p) => roots[p.id] ?? []);
|
|
}
|
|
|
|
/** Keys of every expandable node (Expand All). */
|
|
export function expandableKeys(items: readonly ServiceTreeItem[]): string[] {
|
|
const out: string[] = [];
|
|
const visit = (i: ServiceTreeItem) => {
|
|
if (i.children?.length) {
|
|
out.push(i.key);
|
|
i.children.forEach(visit);
|
|
}
|
|
};
|
|
items.forEach(visit);
|
|
return out;
|
|
}
|
|
|
|
/** The "Add Service" menu: every provider's entries, separated per provider. */
|
|
export function addServiceMenu(providers = serviceProviders()): MenuItem[] {
|
|
const groups = providers.map((p) => p.addMenu?.() ?? []).filter((g) => g.length > 0);
|
|
return groups.flatMap((g, i) => (i === 0 ? g : [{ kind: "separator" } as MenuItem, ...g]));
|
|
}
|
|
|
|
/** The selected node and its provider. */
|
|
export function selectedService(): (Located & { contribution: ServiceProviderContribution | undefined }) | null {
|
|
const { roots, selectedKey } = useServicesTree.getState();
|
|
if (!selectedKey) return null;
|
|
const found = indexTree(roots).get(selectedKey);
|
|
if (!found) return null;
|
|
return { ...found, contribution: serviceProviders().find((p) => p.id === found.provider) };
|
|
}
|