дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 19:25:54 +02:00
Message dialogs: `Dialog` gets an `icon` (question / info / warning / error) that renders IDEA's alert layout: no title bar, a 32px icon, bold title, text, checkbox under it. Every confirmation helper (prompt, VCS, services, project tree, keymap, LSP choices, run, database, Replace All) uses it. Open Project matches IDEA: "This Window" is the default and has focus. The Code Analysis and TODO commit checks default to Review. Project widget: the title bar project button opens a popup like IDEA's ProjectWidget, with Open… / Clone Repository…, the projects open in other windows (new `window_open_projects` command) and recent projects, filtered by typing. Chinese UI: UI text stays written in English and is translated through a source-text catalog (`locales/text/zh.json`, about 2300 strings). The UI primitives (buttons, checkboxes, selects, tabs, dialogs, menus, tooltips, toasts, settings labels and hints) translate the strings they are given. Action titles and categories are localised in the registry, and static JSX text uses `<T>`, so text follows a locale switch without a reload. The Settings window now syncs the locale too. Settings search matches both languages. Claude-Session: https://claude.ai/code/session_01B65qLEKnkeYTGdbwhLpjCu
32 рядки
940 B
TypeScript
32 рядки
940 B
TypeScript
import { Component, type ComponentType, type ReactNode } from "react";
|
|
|
|
interface Props {
|
|
/** Shown in logs to identify the failing contribution. */
|
|
name: string;
|
|
children: ReactNode;
|
|
fallback?: ReactNode;
|
|
}
|
|
|
|
/** Isolates contributed UI so one failing feature can't take down the shell. */
|
|
export class ErrorBoundary extends Component<Props, { error: Error | null }> {
|
|
state = { error: null as Error | null };
|
|
|
|
static getDerivedStateFromError(error: Error) {
|
|
return { error };
|
|
}
|
|
|
|
componentDidCatch(error: Error) {
|
|
console.error(`[workbench] ${this.props.name} crashed`, error);
|
|
}
|
|
|
|
render() {
|
|
if (this.state.error) return this.props.fallback ?? null;
|
|
return this.props.children;
|
|
}
|
|
}
|
|
|
|
/** Renders a component supplied through a slot or contribution. */
|
|
export function Slot<P extends object = object>({ component: C, ...props }: { component: ComponentType<P> } & P) {
|
|
return <C {...(props as P)} />;
|
|
}
|