mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 16:04:21 +00:00
Plugin API 1.4: grants for unencrypted HTTP, local sockets, IDE commands and owned database sources; window status items, output channels, content tabs, editor selections, decorations, search, Problems and VCS reads; runs, keyed terminals with exit events, plugin run targets, dynamic run configurations and test parsers; language features, injections, snippets and menu locations; plugin MCP tools on the built-in server; four official API examples. Released 1.3 plugins keep working.
25 lines
796 B
TypeScript
25 lines
796 B
TypeScript
/**
|
|
* The xterm.js-backed part of the terminal (`runtime.ts`) loads on first use:
|
|
* xterm is ~100 KB gzip that start-up does not need. No terminal session can
|
|
* exist before it has loaded.
|
|
*/
|
|
import type * as Runtime from "./runtime";
|
|
import { useProject } from "@/platform/project";
|
|
|
|
export type TerminalRuntime = typeof Runtime;
|
|
|
|
let loaded: TerminalRuntime | null = null;
|
|
let pending: Promise<TerminalRuntime> | null = null;
|
|
|
|
/** The runtime if it has been loaded, else `null`. */
|
|
export function terminalRuntime(): TerminalRuntime | null {
|
|
return loaded;
|
|
}
|
|
|
|
export function loadTerminalRuntime(): Promise<TerminalRuntime> {
|
|
return (pending ??= import("./runtime").then((m) => {
|
|
m.syncTerminalProject(useProject.getState().project?.root ?? null);
|
|
return (loaded = m);
|
|
}));
|
|
}
|