package openidea:plugin@1.2.0; /// Declarative views: tool windows declared /// under `[[contributes.views]]` and custom editors under /// `[[contributes.customEditors]]`. The plugin describes what to show; the /// IDE renders it with its own components (theme, keyboard, accessibility) /// and sends the user's actions back as `view-event`s. Nothing of the plugin /// runs in the WebView, except a `html` body, which is shown in a sandboxed /// frame that can only exchange messages with the plugin. interface view-types { use types.{extension}; record button { id: string, label: string, /// An IDE icon name (`refresh`, `add`, `remove`, `run`, …). icon: option, enabled: bool, } /// A tree node; `parent` is the key of an earlier item (none: a root). record tree-item { key: string, parent: option, label: string, icon: option, /// Grey text after the label. detail: option, /// Shows an expander even before its children are known /// (`expand` asks for them). expandable: bool, expanded: bool, } record list-item { key: string, label: string, icon: option, detail: option, } variant field-value { text(string), multiline(string), checkbox(bool), /// The options and the chosen one. choice(tuple, string>), /// A field type added after 1.0 (an IDE that doesn't know it leaves it out). other(extension), } record field { key: string, label: string, value: field-value, } /// Rows `first-row`..`first-row + len(rows)` of `total-rows`: the IDE /// asks for the rows it shows (`viewport`), so large tables stay cheap. record table { columns: list, total-rows: u32, first-row: u32, rows: list>, editable: bool, } variant body { /// A centred message (empty state, errors). message(string), tree(list), %list(list), form(list), table(table), /// HTML shown in a sandboxed frame: no scripts from elsewhere, no /// network, no IDE API. Its script talks to the plugin with /// `openidea.postMessage(text)` / `openidea.onMessage(fn)`. html(string), /// A body added after 1.0; an IDE that doesn't know it says it needs updating. other(extension), } record view { toolbar: list