Crate styx_lsp_ext

Crate styx_lsp_ext 

Source
Expand description

§styx-lsp-ext

crates.io documentation MIT/Apache-2.0 licensed

Protocol types for Styx LSP extensions. Defines the RPC interface between the language server and editor extensions.

§Sponsors

Thanks to all individual sponsors:

GitHub Sponsors Patreon

…along with corporate sponsors:

AWS Zed Depot

…without whom this work could not exist.

§License

Licensed under either of:

at your option. Protocol types for Styx LSP extensions.

This crate defines the Roam service traits and types used for communication between the Styx LSP and external extensions that provide domain-specific intelligence (completions, hover, diagnostics, etc.).

§Architecture

┌─────────────┐                      ┌─────────────────┐
│  Styx LSP   │◄────── Roam ────────►│    Extension    │
│             │                      │   (e.g. dibs)   │
│ implements  │                      │   implements    │
│ StyxLspHost │                      │ StyxLspExtension│
└─────────────┘                      └─────────────────┘

The LSP calls methods on StyxLspExtension to request completions, hover, etc. The extension can call back to StyxLspHost to request additional context.

§Generated Types

The #[roam::service] macro generates:

  • StyxLspExtensionClient - Call extension methods from the LSP
  • StyxLspExtensionDispatcher - Dispatch incoming calls on the extension side
  • StyxLspHostClient - Call LSP methods from the extension
  • StyxLspHostDispatcher - Dispatch incoming calls on the LSP side

Re-exports§

pub use roam;

Modules§

styx_lsp_extension_method_id
Method IDs for the service (computed lazily at runtime).
styx_lsp_host_method_id
Method IDs for the service (computed lazily at runtime).

Structs§

CodeAction
A code action (quick fix, refactoring, etc.).
CodeActionParams
Parameters for a code actions request.
CompletionItem
A completion item.
CompletionParams
Parameters for a completion request.
Cursor
Cursor position with both line/character and byte offset.
DefinitionParams
Parameters for a go-to-definition request.
Diagnostic
A diagnostic (error, warning, etc.).
DiagnosticParams
Parameters for a diagnostics request.
DocumentEdit
Edits to a single document.
GetDocumentParams
Parameters for get_document.
GetSchemaParams
Parameters for get_schema.
GetSourceParams
Parameters for get_source.
GetSubtreeParams
Parameters for get_subtree.
HoverParams
Parameters for a hover request.
HoverResult
Result of a hover request.
InitializeParams
Parameters for extension initialization.
InitializeResult
Result of extension initialization.
InlayHint
An inlay hint.
InlayHintParams
Parameters for an inlay hints request.
Location
A location in a document (URI + range).
OffsetToPositionParams
Parameters for offset_to_position.
Position
A position in a document (0-indexed line and character).
PositionToOffsetParams
Parameters for position_to_offset.
Range
A range in a document.
SchemaInfo
Information about the schema.
StyxLspExtensionClient
Client for StyxLspExtension service.
StyxLspExtensionDispatcher
Dispatcher for this service.
StyxLspHostClient
Client for StyxLspHost service.
StyxLspHostDispatcher
Dispatcher for this service.
TextEdit
A text edit (replace a range with new text).
WorkspaceEdit
A workspace edit (changes to one or more documents).

Enums§

Capability
Capabilities an extension can support.
CodeActionKind
Kind of code action.
CompletionKind
Kind of completion item.
DiagnosticSeverity
Severity of a diagnostic.
InlayHintKind
Kind of inlay hint.

Traits§

StyxLspExtension
Service implemented by LSP extensions.
StyxLspHost
Service implemented by the Styx LSP for extension callbacks.

Functions§

styx_lsp_extension_service_detail
Returns the service detail for codegen.
styx_lsp_host_service_detail
Returns the service detail for codegen.