feat(sdk,plugins): ajoute capability tooling et services runtime publics (workspace/terminal/tasks)
- capability manifeste tooling supportée backend + transport runtime catalog - ctx.services publique côté SDK/runtime, gated par tooling - surface honnête: workspace, terminal, et tasks en observation/contrôle uniquement - docs/exemple/tests mis à jour - QA PASS sur feature/sdk-plugin-tooling-build-debug-surface
This commit is contained in:
@ -25,6 +25,7 @@ import {
|
||||
type LoadedPlugin,
|
||||
type PluginGatewaySet,
|
||||
} from "./registry";
|
||||
import { createPluginServices, type PluginServices } from "./services";
|
||||
|
||||
export type { PluginGatewaySet } from "./registry";
|
||||
|
||||
@ -37,6 +38,7 @@ export interface IdeaPluginContext extends PluginGatewaySet {
|
||||
commands: PluginCommandContext;
|
||||
layouts: PluginLayoutRegistry;
|
||||
menu: PluginMenuRegistry;
|
||||
services?: PluginServices;
|
||||
}
|
||||
|
||||
export interface PluginActivation {
|
||||
@ -177,6 +179,10 @@ function normalizeContributes(entry: PluginRuntimePlugin): PluginContributionDto
|
||||
};
|
||||
}
|
||||
|
||||
function hasCapability(entry: PluginRuntimePlugin, capability: string): boolean {
|
||||
return arrayOrEmpty<string>(objectOrEmpty(entry).capabilities).includes(capability);
|
||||
}
|
||||
|
||||
async function disposeAll(disposables: Disposable[], activation?: void | PluginActivation): Promise<void> {
|
||||
try {
|
||||
await activation?.dispose?.();
|
||||
@ -247,6 +253,9 @@ async function loadOne(
|
||||
menu,
|
||||
...gateways,
|
||||
};
|
||||
if (hasCapability(entry, "tooling")) {
|
||||
ctx.services = createPluginServices(gateways);
|
||||
}
|
||||
|
||||
activation = await withTimeout(
|
||||
Promise.resolve(mod.activate(ctx)),
|
||||
|
||||
Reference in New Issue
Block a user