Файли
openidea/plugins/hello/plugin.toml
T
l0ng-ai 78e0c7a23e feat(plugins): finalize plugin API before release, concurrent providers
Plugin API (breaking; the plugin system is unreleased):
- Remove the runtime `contributions` interface (register-command,
  register-language, register-theme). Commands, languages and themes are
  declared in plugin.toml only, so everything a plugin contributes goes
  through the install preview and consent. The registry drops runtime
  scope, `contribute` and `dispose_runtime`; inline `definition` in
  language and theme declarations is gone.
- `completion-item.kind` is a string (the 25 LSP kinds; unknown kinds show
  no icon), like the other open-ended kinds.
- `lifecycle.activate` and `commands.run` return `types.error` instead of a
  string. The host maps it to the matching error kind, and only `failed`
  counts against the plugin: cancelling, a missing grant or an unknown
  command does not. The SDK's `Plugin` returns `Result<_, Error>`; plain
  messages convert to `Error::Failed`.

Runtime:
- Editor providers of several plugins are called at the same time
  (`Actor::submit` + `Pending::wait`): the wait is the slowest plugin's,
  not the sum, so each gets the full edit-path budget.

Versioning and tooling:
- Components are checked at install and by `openidea-plugin check` for the
  plugin API they were built for; another major or a newer minor is
  refused with what to do.
- Tests: the SDK's WIT matches the host's, a simulated next-minor host
  links every shipped component, every host function has an SDK wrapper,
  released APIs only grow (no snapshot until the first release).
- plugins/build.sh builds every checked-in component, records a source
  fingerprint next to it, and `--check` fails on stale components; CI runs
  it plus fmt, clippy (host and wasm) and tests for the SDK, the official
  plugins and the fixtures.
- The API evolution rules and the checklist for a new host function are in
  plugins/README.md; the design notes under docs/ are removed.
2026-11-04 02:41:46 +08:00

53 рядки
1.5 KiB
TOML

id = "hello"
name = "Hello"
version = "0.3.0"
description = "Sample plugin: inserts today's date, counts words in the active file and shows a tool window with a tree."
authors = ["OpenIDEA contributors"]
change-notes = """
0.3.0 — a Greetings tool window (tree view), an editor context menu entry, a shortcut and a status bar item.
0.2.0 — plugin API 0.2: edits are versioned, one undo step for every cursor.
0.1.0 — first release: Insert Date and Word Count of Active File commands.
"""
engines.openidea = "^1.0"
wasm = "dist/plugin.wasm"
# Loaded the first time one of its commands runs.
activation = ["on-command:*", "on-view:greetings"]
[capabilities]
required = ["editor.read", "editor.write"]
# Static declarations make the commands visible before the plugin activates;
# a command must be declared here to exist.
[[contributes.commands]]
id = "insert-date"
title = "Hello: Insert Date"
category = "Hello"
[[contributes.commands]]
id = "word-count"
title = "Hello: Word Count of Active File"
category = "Hello"
# Declarative UI: shown without loading the plugin's code.
[[contributes.menus]]
menu = "editor.context"
command = "word-count"
[[contributes.keymaps]]
command = "insert-date"
key = "Ctrl+Alt+D"
mac = "Meta+Alt+D"
[[contributes.statusBar]]
id = "hello"
text = "Hello"
tooltip = "Word count of the active file"
command = "word-count"
# A tool window whose tree the plugin renders (view-provider).
[[contributes.views]]
id = "greetings"
title = "Greetings"
icon = "plugin"
location = "right"