Файли
openidea/wit/rename.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

47 рядки
1.5 KiB
Plaintext

package openidea:[email protected];
/// Optional export (world `plugin-rename`, API 1.21): prepare-rename and
/// cross-file workspace rename edits alongside native language servers.
interface rename-provider {
use types.{error, position, range, text-edit};
/// The document the rename is in (matching `providers.document`).
record document {
path: string,
language: string,
version: u64,
text: string,
}
/// Text edits to one file (matching `providers.file-edit`).
record file-edit {
path: string,
edits: list<text-edit>,
}
/// Editable target range and optional prefilled text for inline/dialog rename.
record prepare-rename-result {
range: range,
placeholder: option<string>,
}
/// Checks whether `at` names a symbol this plugin can rename, under the
/// editing-path budget. Returning `none` lets other providers or LSP answer.
prepare-rename: func(doc: document, at: position) -> option<prepare-rename-result>;
/// Computes cross-file edits to rename the symbol at `at` to `new-name`
/// (command budget; runs alongside any native language server).
rename: func(doc: document, at: position, new-name: string) -> result<list<file-edit>, error>;
}
/// The optional export-only world the SDK merges with `plugin`.
world rename-exports {
export rename-provider;
}
/// The host-side world used to instantiate a component that exports it.
world plugin-rename {
include plugin;
export rename-provider;
}