Файли
openidea/src/workbench/ContributedToolbar.tsx
T
RuyimgByCN b83c1a60c2 feat(plugins): run lifecycle events, run.stop, configuration upsert, Java debug attach, log tail tabs and console toolbar (API 1.21) (#7776)
Plugin API 1.21:
- run-started events, and run-exited for user-launched plugin configurations (plugins on API 1.21 only).
- run.stop(id) for runs of the plugin's own configurations; run.upsert-configuration and run.open-edit-configurations for the plugin's own run configuration types.
- prepareCommand receives the run/debug mode; plugin configurations can declare a loopback JDWP attach target.
- runConfigTypes.ownsBeforeLaunch, log file tabs in the run console (plugin_run_log_tail, authorised by the plugin's project.read / fs.read grants), and the runConsole.toolbar menu in the Run and Debug consoles.

Review fixes: RunView log tab state keyed by the string session id, tail chunks cut on a UTF-8 boundary, user-run exits gated to API 1.21.

Co-authored-by: RuyimgByCN <[email protected]>
2026-12-03 20:29:31 +08:00

37 рядки
1.1 KiB
TypeScript

/** Plugin action slots in existing editor and main toolbars. */
import { useActions } from "@/platform/actions";
import { useContextKeys, evaluateWhen, type ContextValue } from "@/platform/context";
import { IconButton } from "@/ui";
import { useMenuSlotItems } from "./contributions";
import { keepFocusOnPress } from "./focus";
export function ContributedToolbar({
slot,
whenContext,
defaultArg,
}: {
slot: string;
whenContext?: Record<string, ContextValue>;
defaultArg?: string;
}) {
const actions = useActions((s) => s.actions);
const items = useMenuSlotItems((s) => s.slots[slot]);
useContextKeys();
return (
<>
{(items ?? [])
.filter((i) => evaluateWhen(i.when ?? undefined, whenContext))
.map((i) => (
<IconButton
key={i.action}
icon={actions.get(i.action)?.icon ?? i.icon ?? "plugin"}
action={i.action}
actionArg={i.arg ?? defaultArg}
title={i.label}
size="small"
onMouseDown={keepFocusOnPress}
/>
))}
</>
);
}