Lattice Plugin API

The plugin API is the WIT package lattice:plugin-host@0.1.0 — 31 interfaces ("seams") and 25 worlds. It is the whole contract: a plugin written in any language with Component-Model tooling (Rust, Go, Zig, JavaScript, …) sees exactly what is on these pages and nothing else. This reference is generated from the .wit files in crates/lattice-wit/wit/, so it cannot disagree with them.

New to writing plugins? Start with the plugin authoring guide, then come back here for the detail. The same reference in machine-readable form — every seam, signature, type and member — is docs/dev/reference/plugin-api.json in the repository and /plugin-api.json on the documentation site.

How to read this reference

  • A plugin targets one world. The world decides which seams the plugin exports (implements — the host calls it) and which it imports (calls into the host). In Rust: wit_bindgen::generate!({ world: "comment-plugin", path: "…/wit" }).
  • Direction on each seam says which of those it is. A seam marked shared types only is never called; other seams use its types.
  • Capability is what the seam requires of a plugin's grant. Most are none: the host does the I/O and hands the guest data.
  • Resources (resource document) are handles to host-owned state. A borrow<document> parameter is valid for that call only.
  • Errors are result<T, string>: an err carries a message the host surfaces to the user, so it should say what went wrong.
  • WIT to Rust (wit-bindgen): kebab-case becomes snake_case for functions and fields and UpperCamelCase for types; list<T> is Vec<T>, option<T> is Option<T>, result<T, E> is Result<T, E>, borrow<r> is &R.

Worlds (25)

Each world's entry points — the register-* functions the host calls on load — are on the worlds page.

WorldExports (you implement)Imports (you may call)
auto-pair-plugingrammar-callbacks; register-grammar, register-modes, register-options, register-help-topicsbuffer, config, grammar, help, modes, tree-sitter, types
comment-plugingrammar-callbacks; register-grammar, register-modes, register-options, register-help-topicsbuffer, config, grammar, help, modes, tree-sitter, types
completion-source-plugincompletion-sourcehost-services, logging, project, types
config-pluginregister-optionsconfig, logging, project
context-plugincontexthost-services, logging, project, tree-sitter, types
dashboard-pluginregister-dashboard-sections, render-sectiondashboard, logging, project
decorations-plugindecorationshost-services, logging, project, types
error-parser-pluginreset, feederror-parser, logging
events-pluginregister-events, on-event, on-wakeevents, host-services, logging, multibuffer-view-registry, project, types
grammar-plugingrammar-callbacks; register-grammarbuffer, grammar, tree-sitter, types
help-pluginregister-help-topicshelp, logging, project
keymap-pluginregister-keymapkeymap, logging, project
language-pluginregister-languageslanguage, logging, project
media-pluginmediahost-services, logging, project, types
modes-pluginregister-modeslogging, modes, project
multibuffer-view-pluginmultibuffer-view-source; register-multibuffer-viewshost-services, logging, multibuffer-view-registry, project, types
picker-source-pluginpicker-source; register-picker-sourceshost-services, logging, picker-registry, project, types
pluginactivate, deactivatebuffer, host-services, logging, project, types, ui
plugin-manager-pluginregister-pluginslogging, plugin-manager, project
project-plugingrammar-callbacks, picker-source, transient-source; register-grammar, register-picker-sources, register-modes, register-options, register-help-topics, register-events, on-event, on-wakebuffer, config, events, grammar, help, host-services, modes, picker-registry, project, tree-sitter, types
scanned-excerpt-source-pluginextensions, view-mode, roots, begin, describe, scanconfig, logging, project, scanned-excerpt-source, tree-sitter, types
sign-pluginregister-signslogging, project, signs
theme-pluginregister-theme-elementslogging, project, theme
transient-source-plugintransient-sourcelogging, project, types
treesitter-context-plugincontext, grammar-callbacks; register-options, register-grammar, register-modes, register-help-topicsbuffer, config, grammar, help, modes, tree-sitter, types

Seams (31)

SeamDirectionCapabilityFunctionsTypesSummary
bufferimports-52Mirrors the native Document / Buffer read seam (plugin-host.md §4.2, §9.6).
commandtypes-00Mirrors CommandRegistry + CommandInvocation + the closed Effect enum (lattice-grammar).
completion-sourceexports-20Mirrors lattice_completion completion sources (PH7.6).
configimports-87Mirrors ConfigRegistry (lattice-config).
contextexports-10The structural-context producer API (treesitter-context.md, TC.2): the scopes a pane pins above its text once their own header lines have scrolled away — the nvim-treesitter-context / sticky-scroll idea.
dashboardimports-17CR.4: plugin-contributed dashboard sections.
decorationsexports-10The decoration producer API (plugin-host.md §5 decorations, PH7.9), mirroring Mode::gutter_decorations + GutterDecoration (lattice-mode).
error-parsertypes-02CM.6: plugin-contributed compilation-output parsers.
eventsimports-31The event/hook subscription API (plugin-host.md §5 events, PH7.8).
grammarimports-50The grammar-extension API (plugin-host.md §4.1, PH7.7).
grammar-callbacksexports-60The behavior callbacks a grammar plugin exports; the host calls one by callback id on dispatch (the PH7.3d callback-id trampoline).
helpimports-10CR.3: plugin-contributed :help pages.
host-servicesimportsfs201Guest→host services (plugin-host.md §5).
keymapimports-11The keymap guest→host binding-registration seam (PL8.D.1).
languageimports-12LG.3c: plugin-contributed languages.
loggingimports-11Guest→host structured logging (plugin observability Layer 2, design docs/dev/architecture/plugin-observability.md §8).
mediaexports-10The inline-media producer API (IM.6, inline-media.md §7).
modesimports-38Mirrors the Mode trait declaration surface + ModeRegistry (lattice-mode).
multibuffer-view-registryimports-20MV.1 — the seam by which a plugin owns a multibuffer view.
multibuffer-view-sourceexports-10
picker-registryimports-10OR.5b — the host import a picker plugin registers its sources through.
picker-sourceexports-21Mirrors PickerSourceGenerator (lattice_picker::source).
plugin-managerimportsproc13PM.7: the require seam — how a user's init.rs declares the plugins it wants (plugin-manager.md §3).
projectimportsfs22Guest→host project resolution (PR.6, design docs/dev/architecture/project-resolution.md §6).
scanned-excerpt-sourcetypes-04OM.A1: plugin-contributed agenda rows.
signsimports-11Mirrors the sign registry (lattice_mode::SignRegistry).
themeimports-23Mirrors the theme-element registry (lattice-theme).
transient-sourceexports-20TR.2b: plugin-contributed transient menus.
tree-sitterimports-256Structural queries for plugins (plugin-treesitter-seam.md).
typestypes-0147Shared boundary records/variants — the owned, WIT-serializable mirrors of the native grammar + picker/completion types (plugin-host.md §4).
uiimports-30The UI-contribution surface (design.md §9.4 ui): guest→host emits data only, never draw calls (§7, paramount #1).