Skip to main content

Crate lsdocs_protocol

Crate lsdocs_protocol 

Source
Expand description

Message and capability types for the lsdocs plugin protocol.

The host and plugins exchange requests and notifications. Each one is a marker type implementing Request or Notification, which ties the method name to its parameter and result types; see request and notification. How messages are framed and sent is up to the rpc crate; this crate only defines what is inside them.

§Lifecycle

  1. Host -> plugin: request::Initialize; the plugin answers with its Capabilities.
  2. Host -> plugin: notification::Initialized.
  3. Phase requests, as the plugin’s capabilities allow: request::Parse, request::ParseTransformEach, then once request::ParseTransformAll, request::RenderTransformEach, request::Render, then once request::RenderTransformAll.
  4. Host -> plugin: request::Shutdown, then notification::Exit.

Plugins may send notification::Log, notification::Progress and notification::Diagnostics at any time after initialization.

§Encoding

Messages are MessagePack. Use msgpack::encode and msgpack::decode, which write structs as maps (never positional arrays) so that fields can be added without breaking plugins in other languages. Field names are snake_case; optional fields are omitted when empty; unknown fields are ignored.

Re-exports§

pub use lsdocs_doctree as doctree;

Modules§

msgpack
MessagePack encoding following the protocol’s rules.
notification
Notifications, as marker types.
request
Requests, as marker types.

Structs§

CancelParams
Parameters of notification::Cancel.
Capabilities
What a plugin can do. A phase the plugin does not support is omitted.
ConfigInfo
Where a plugin’s settings are: the site’s .config/ directory, whose layout is the plugin’s business (the recommended one is <vendor>/<name>/), and the plugin’s name in the site config.
Diagnostic
A problem to report to the user, modeled on LSP diagnostics.
DiagnosticsParams
Parameters of notification::Diagnostics.
DirectiveSyntax
A directive: what it accepts, so parsers can split its parts.
HostParseParams
Parameters of request::HostParse.
InitializeParams
Parameters of request::Initialize.
InitializeResult
Result of request::Initialize.
LogParams
Parameters of notification::Log.
OutputFile
A file for the host to write.
ParseCapability
Parsing capability.
ParseParams
Parameters of request::Parse.
ParseResult
Result of request::Parse.
ParseTransformAllParams
Parameters of request::ParseTransformAll.
ParseTransformAllResult
Result of request::ParseTransformAll.
ParseTransformEachParams
Parameters of request::ParseTransformEach.
ParseTransformEachResult
Result of request::ParseTransformEach.
ProgramInfo
Name and version of a program taking part in the protocol.
ProgressParams
Parameters of notification::Progress.
RenderCapability
Rendering capability.
RenderParams
Parameters of request::Render.
RenderResult
Result of request::Render.
RenderTransformAllParams
Parameters of request::RenderTransformAll.
RenderTransformAllResult
Result of request::RenderTransformAll.
RenderTransformEachParams
Parameters of request::RenderTransformEach.
RenderTransformEachResult
Result of request::RenderTransformEach.
RenderedPage
A page written by the render phase.
RoleSyntax
A role: inline text with a name, e.g. :kbd:`Ctrl+C`.
SiteInfo
Site-wide settings plugins may need, e.g. for building links.
Syntax
Syntax extensions: directives and roles that plugins give meaning to.
TransformCapability
Transform capability.

Enums§

ArgumentSyntax
How a directive’s argument is read.
ContentSyntax
What a directive’s content is.
LogLevel
Level of a LogParams message.
OptionSyntax
What a directive option takes.
Severity
Severity of a Diagnostic.

Constants§

PROTOCOL_VERSION
Protocol version spoken by this crate: MAJOR.MINOR, with -rc.N for a release candidate. See compatible and “Versions” in spec/wire.md.

Traits§

Notification
A notification: a message with no response.
Request
A request: a message that expects a response.

Functions§

compatible
Whether peers speaking protocol versions a and b can talk: the same major version, and, if either is a release candidate, the very same version. Minor versions only add things older peers can ignore.