Expand description
lspf — a Rust framework for building extensible LSP language servers.
See CONTEXT.md and docs/adr/ at the repository root for the domain
language and the architectural decisions that shape this crate.
The public protocol surface follows the stable LSP 3.18 specification.
Re-exports§
pub use features::FeatureSpec;pub use features::NotificationFeatureSpec;
Modules§
- features
- Standard LSP feature descriptors (ADR 0017).
- types
- LSP protocol types — re-exported from
gen-lsp-typesper ADR 0032.
Structs§
- Cancellation
Token - Cancellation primitive passed to every request handler (ADR 0007). A token which can be used to signal a cancellation request to one or more tasks.
- Child
Connection - An initialized Client connection that owns and supervises its stdio child.
- Child
Output - The terminal result of a supervised stdio language-server child.
- Client
- An LSP client endpoint configured for one connection.
- Client
Builder - Builder for one
Clientconnection. - Client
Connection - A connected client endpoint and its remaining inbound driver.
- Client
Context - Per-call handle passed to server-to-client handlers.
- Client
Handle - A cloneable typed handle for messages sent to the current LSP client.
- Connection
Failure - One connection-level failure delivered to
ServerBuilder::on_error. - Connection
Failure Context - Non-sensitive identity attached to a connection failure when available.
- Document
- A single tracked text document (ADR 0005).
- Documents
View - The read-only view of the connection’s documents that
ServerContext::documentshands to user code (ADR 0018). - Incoming
Call - A validated, decoded call at the user Layer boundary.
- Initialize
Registrar - The transactional registrar handed to
configure_initialize(ADR 0017). - Json
RpcError - A JSON-RPC error object.
- Memory
File Provider - An in-memory
FileProviderintended for tests and virtual resources. - Next
- The next inner Service in a user Layer chain.
- Notebook
- A snapshot of one synchronized notebook.
- Notebooks
View - Read-only access to the synchronized notebooks owned by one connection.
- OsFile
Provider - The default
FileProviderthat readsfile:URIs from the local filesystem. - OsFile
Provider Builder - Configures an
OsFileProviderbefore it is built. - Partial
Result Sink - A request-scoped, typed destination for partial result chunks.
- Progress
Handle - The connection-scoped handle for one work-done progress operation, created
with a server-allocated token by
ClientHandle::begin_progressor with the inbound request’s token byServerContext::begin_progress. - Progress
Options - Options for
ClientHandle::begin_progress, mapped verbatim onto the work-done begin notification. - Resource
Policy - Finite budgets for resources owned by one LSP connection.
- Server
- Owns exactly one LSP connection: its application state, the static
registrations awaiting the initialize transaction, the optional
initialization-dependent callback, and the lifecycle hooks (
on_initialize,on_initialized,on_shutdown,on_exit) (ADR 0017, ADR 0018). A second connection requires a secondServer; connection state is never shared between servers. - Server
Builder - Collects static registrations for one connection before handing them to a
Server(ADR 0017). Registration mistakes are recorded and surfaced bybuild; the builder methods stay chainable. - Server
Context - Per-request handle to framework state (see ADR 0009).
- Server
Handle - A cloneable typed handle for messages sent to the connected LSP server.
- Stdio
Builder - A default-stdio Server builder ready to be served.
- Stdio
Reader - Read half of
StdioTransport. - Stdio
Transport - A
Content-Lengthframed Transport over process standard input and output. - Stdio
Writer - Write half of
StdioTransport. - Workspace
- Cloneable handle to the connection’s workspace state (ADR 0017, ADR 0034).
Enums§
- Build
Error - A configuration error surfaced by
ServerBuilder::build. - Call
Kind - Whether a normalized user call came from a request or a notification.
- Child
Error - A failure while building, launching, driving, or reclaiming a stdio child.
- Client
Error - A typed peer operation or client-endpoint lifecycle transition failed.
- Connection
Direction - The direction in which a reported connection failure occurred.
- Connection
Failure Category - A stable class of connection-level failure observed by an error hook.
- Connection
Request Id - Non-sensitive identity for a JSON-RPC request.
- Error
- A terminal framework or Transport failure while serving a connection.
- LspError
- A JSON-RPC/LSP error suitable for returning from a handler.
- Outcome
- How one connection ended.
- Position
Encoding - Negotiated meaning of
Position.character(ADR 0016). - Progress
Error - A failure of the connection-scoped work-done progress lifecycle
(
ClientHandle::begin_progressand the resultingProgressHandle). - RawMessage
- A validated JSON-RPC envelope with parameters and results retained as raw UTF-8 JSON bytes.
- Request
Id - A JSON-RPC request identifier accepted by LSP.
- Resource
Policy Field - A field whose value made a
ResourcePolicyinvalid. - Service
Result - The only outcomes of normalized user dispatch.
- Telemetry
Event Params - The payload of a
telemetry/eventnotification. - Transport
Error - A Transport framing, channel, or serialization failure.
- Workspace
Error - Failure to resolve a document through the connection’s workspace.
Constants§
- DEFAULT_
CONCURRENCY_ LIMIT - Cap on calls in flight inside the user Layer chain when a
Serverdoes not set its own withServerBuilder::concurrency_limit(ADR 0012).
Traits§
- File
Provider - Supplies text for resources that are not open in the editor.
- Layer
- Adds cross-cutting behavior around normalized user dispatch.
- Partial
Result Request - A standard LSP request whose metaModel entry defines a partial result.
- Shared
Handler - One target-aware erasure boundary for handlers shared by runtime tasks.
- Task
Future - A type-erased future that preserves the target’s task mobility bound.
- Task
Send - Target-dependent task mobility bound.
- Transport
- A message-framed channel for LSP JSON-RPC envelopes (see ADR 0011).
- Transport
Reader - Read half of a
Transport(ADR 0011, ADR 0015). - Transport
Writer - Write half of a
Transport(ADR 0011, ADR 0015).shutdownconsumes the writer so the send-loop task can flush remaining bytes after the outgoing channel is drained.
Functions§
Type Aliases§
- Result
- Result type returned by serving and Transport entry points.
- Service
Future - Boxed future returned by a user
Layer.