дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 11:15:40 +02:00
feat(plugins): plugin system with extension points, consent, Wasm runtime and plugin API 1.0 (#971)
A plugin system built on WebAssembly components (wasmtime, WASI p2), with a typed WIT API (`openidea:[email protected]`) and a Rust SDK, shipped as a preview. - Extension points declared in `plugin.toml` (commands, languages, themes, icon themes, menus, key bindings, status items, settings, views, custom editors, file icons and templates, run detectors, editor providers), validated before anything takes effect and projected onto the workbench's own registries: plugin themes and file icon themes are chosen in Settings › Appearance and Quick Switch, plugin shortcuts are edited in Settings › Keymap, plugin problems are grouped in Settings › Inspections. - Capabilities with risk levels and consent at install, pinned `process:` programs, secrets in the OS keychain. - Runtime: one thread per active plugin, fuel/time/memory budgets, soft and hard deadlines on the editing path, cancellation, crash backoff, idle reclaim, a precompiled-component cache; remote projects run code plugins on `openidea-server`. - Web views and custom editors with a sandboxed page, a document bridge joined to the text editor's undo history, and split or preview layouts. - Distribution: signed `.oiplugin` packages, a static marketplace index with revocation, versioned installs with rollback, install from a `.zip` or a folder. The release workflow signs and publishes the official plugins and their index, which released builds use as the default marketplace. - Official plugins: String Tools, Key Promoter, Git Toolbox, AI Completion, Checkstyle, MyBatis Navigator, CSV Editor, Solidity, Material Icons, Harbor Night, Excalidraw, Graphviz, Regex Tester, License Header. Closes #732 Co-authored-by: Deng Liu <[email protected]> Co-authored-by: florentvdry <[email protected]>
Цей коміт міститься в:
450 files changed
+47018
-3058
No files matched your search
@@ -7,13 +7,13 @@
|
||||
* shortcut text of every keymap binding, so the menu shows the JS keymap's
|
||||
* shortcuts without registering native accelerators (see src-tauri/src/menu.rs).
|
||||
*/
|
||||
import { executeAction, getAction, isActionEnabled, useActions } from "@/platform/actions";
|
||||
import { executeActionFrom, getAction, isActionEnabled, useActions } from "@/platform/actions";
|
||||
import { useContextKeys } from "@/platform/context";
|
||||
import { keysWithPrefix, t, tx, useI18n } from "@/platform/i18n";
|
||||
import { commands, isTauri, type DynamicItem, type MenuConfig, type MenuNode } from "@/platform/ipc";
|
||||
import { effectiveBindings, formatBinding, primaryKeyBinding, useKeymap } from "@/platform/keymap";
|
||||
import { useProject } from "@/platform/project";
|
||||
import { useContributions } from "@/workbench/contributions";
|
||||
import { useContributions, useMenuSlotItems } from "@/workbench/contributions";
|
||||
import { isDistractionFree, useDistractionFree } from "@/workbench/distractionFree";
|
||||
import { useToolWindowLayouts } from "@/workbench/toolwindows/layouts";
|
||||
import { hostOs, type HostOs } from "./host";
|
||||
@@ -30,7 +30,10 @@ export function isMenuRoute(v: unknown): v is MenuRoute {
|
||||
}
|
||||
|
||||
/** Runs the action a menu item stands for. Returns whether it ran. */
|
||||
export function routeMenuEvent(payload: unknown, run = executeAction): Promise<boolean> {
|
||||
export function routeMenuEvent(
|
||||
payload: unknown,
|
||||
run = (id: string, arg?: unknown) => executeActionFrom("menu", id, arg),
|
||||
): Promise<boolean> {
|
||||
if (!isMenuRoute(payload) || !payload.action) return Promise.resolve(false);
|
||||
return run(payload.action, payload.arg ?? undefined);
|
||||
}
|
||||
@@ -62,7 +65,15 @@ export function dynamicMenuItems(): Record<string, DynamicItem[]> {
|
||||
const layouts = useToolWindowLayouts
|
||||
.getState()
|
||||
.layouts.map((l) => ({ action: "layout.restore", arg: l.name, label: l.name }));
|
||||
return { toolWindows, toolWindowLayouts: layouts };
|
||||
const slots = Object.fromEntries(
|
||||
Object.entries(useMenuSlotItems.getState().slots).map(([slot, items]) => [
|
||||
slot,
|
||||
[...items]
|
||||
.map((i) => ({ action: i.action, arg: i.arg ?? null, label: tx(i.label) ?? i.label }))
|
||||
.sort((a, b) => a.label.localeCompare(b.label)),
|
||||
]),
|
||||
);
|
||||
return { ...slots, toolWindows, toolWindowLayouts: layouts };
|
||||
}
|
||||
|
||||
/** Action ids of every IDE item in a menu model. */
|
||||
@@ -150,6 +161,7 @@ export function installMenuBridge(): () => void {
|
||||
if (s.toolWindows !== prev.toolWindows) push();
|
||||
}),
|
||||
useToolWindowLayouts.subscribe(push),
|
||||
useMenuSlotItems.subscribe(push),
|
||||
useContextKeys.subscribe(() => pushEnablement()),
|
||||
useActions.subscribe(() => pushEnablement()),
|
||||
// Opening / closing a project changes the Open Recent list.
|
||||
|
||||
Reference in new issue
Заблокувати користувача