Файли
openidea/sdk/rust/openidea-plugin/wit/completion-resolve.wit
T
RuyimgByCN acf5e53953 fix(plugins): define local records in rename and completion-resolve WIT interfaces (#8151)
A plugin exporting `providers` together with `rename` or `completion_resolve` failed to link: `rename-provider` and `completion-resolve-provider` imported their `document`, `file-edit` and `completion-item` types from `providers`, and wit-component refuses to add `providers` as an export once another export depends on it as an import. Both interfaces now define those records locally, like hover, file-actions and diagnostics already do. The rename and completion-resolve fixtures co-export `providers`, and all components are rebuilt. These interfaces are new in API 1.21, which has not been released.

Co-authored-by: RuyimgByCN <[email protected]>
2026-12-05 13:46:18 +08:00

56 рядки
1.8 KiB
Plaintext

package openidea:[email protected];
/// Optional export (API 1.21, world `plugin-completion-resolve`): completion items
/// carrying an opaque `data` token resolved lazily via `resolve` on selection.
interface completion-resolve-provider {
use types.{error, position, range, text-edit};
/// The document a request is about (matching `providers.document`).
record document {
path: string,
language: string,
version: u64,
text: string,
}
/// A completion item (matching `providers.completion-item`).
record completion-item {
label: string,
detail: option<string>,
kind: option<string>,
insert-text: string,
snippet: bool,
replace: option<range>,
sort-text: option<string>,
filter-text: option<string>,
documentation: option<string>,
additional-edits: list<text-edit>,
}
record completion-item-ref {
item: completion-item,
/// Opaque reference passed back to `resolve` once this item is focused.
data: option<string>,
}
record resolvable-completion-list {
items: list<completion-item-ref>,
/// Same semantics as `completion-list-provider.completion-list.incomplete`.
incomplete: bool,
}
completion: func(doc: document, at: position, trigger: option<string>) -> resolvable-completion-list;
resolve: func(doc: document, item: completion-item-ref) -> result<completion-item, error>;
}
/// The optional export-only world the SDK merges with `plugin`.
world completion-resolve-exports {
export completion-resolve-provider;
}
/// The host-side world used to instantiate a component that exports it.
world plugin-completion-resolve {
include plugin;
export completion-resolve-provider;
}