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
- Host -> plugin:
request::Initialize; the plugin answers with itsCapabilities. - Host -> plugin:
notification::Initialized. - Phase requests, as the plugin’s capabilities allow:
request::Parse,request::ParseTransformEach, then oncerequest::ParseTransformAll,request::RenderTransformEach,request::Render, then oncerequest::RenderTransformAll. - Host -> plugin:
request::Shutdown, thennotification::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§
- Cancel
Params - Parameters of
notification::Cancel. - Capabilities
- What a plugin can do. A phase the plugin does not support is omitted.
- Config
Info - 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.
- Diagnostics
Params - Parameters of
notification::Diagnostics. - Directive
Syntax - A directive: what it accepts, so parsers can split its parts.
- Host
Parse Params - Parameters of
request::HostParse. - Initialize
Params - Parameters of
request::Initialize. - Initialize
Result - Result of
request::Initialize. - LogParams
- Parameters of
notification::Log. - Output
File - A file for the host to write.
- Parse
Capability - Parsing capability.
- Parse
Params - Parameters of
request::Parse. - Parse
Result - Result of
request::Parse. - Parse
Transform AllParams - Parameters of
request::ParseTransformAll. - Parse
Transform AllResult - Result of
request::ParseTransformAll. - Parse
Transform Each Params - Parameters of
request::ParseTransformEach. - Parse
Transform Each Result - Result of
request::ParseTransformEach. - Program
Info - Name and version of a program taking part in the protocol.
- Progress
Params - Parameters of
notification::Progress. - Render
Capability - Rendering capability.
- Render
Params - Parameters of
request::Render. - Render
Result - Result of
request::Render. - Render
Transform AllParams - Parameters of
request::RenderTransformAll. - Render
Transform AllResult - Result of
request::RenderTransformAll. - Render
Transform Each Params - Parameters of
request::RenderTransformEach. - Render
Transform Each Result - Result of
request::RenderTransformEach. - Rendered
Page - A page written by the render phase.
- Role
Syntax - A role: inline text with a name, e.g.
:kbd:`Ctrl+C`. - Site
Info - Site-wide settings plugins may need, e.g. for building links.
- Syntax
- Syntax extensions: directives and roles that plugins give meaning to.
- Transform
Capability - Transform capability.
Enums§
- Argument
Syntax - How a directive’s argument is read.
- Content
Syntax - What a directive’s content is.
- LogLevel
- Level of a
LogParamsmessage. - Option
Syntax - What a directive option takes.
- Severity
- Severity of a
Diagnostic.
Constants§
- PROTOCOL_
VERSION - Protocol version spoken by this crate:
MAJOR.MINOR, with-rc.Nfor a release candidate. Seecompatibleand “Versions” inspec/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
aandbcan 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.