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.
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
lsp-typesper ADR 0014.
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.
- Client
- A cloneable typed handle for messages sent to the current LSP client.
- Context
- Per-request handle to framework state (see ADR 0009).
- Document
- A single tracked text document (ADR 0005).
- Documents
View - The read-only view of the connection’s documents that
Context::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 - Memory
File Provider - An in-memory
FileProviderintended for tests and virtual resources. - Next
- The next inner Service in a user Layer chain.
- OsFile
Provider - The default
FileProviderthat readsfile:URIs from the local filesystem. - OsFile
Provider Builder - Configures an
OsFileProviderbefore it is built. - Progress
Handle - The connection-scoped handle for one work-done progress operation,
created by
Client::begin_progress. - Progress
Options - Options for
Client::begin_progress, mapped verbatim onto the work-done begin notification. - 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. - Stdio
Builder - Stdio
Reader - Stdio
Transport - Stdio
Writer - Workspace
- Cloneable handle to the connection’s workspace state (ADR 0017).
Enums§
- Build
Error - A configuration error surfaced by
ServerBuilder::build. - Call
Kind - Whether a normalized user call came from a request or a notification.
- Client
Error - A failure to enqueue a typed server-to-client operation.
- Error
- LspError
- 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
(
Client::begin_progressand the resultingProgressHandle). - RawMessage
- Service
Result - The only outcomes of normalized user dispatch.
- Telemetry
Event Params - The payload of a
telemetry/eventnotification. - Transport
Error - 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). - DEFAULT_
OUTBOUND_ WARNING_ THRESHOLD - Outbound queue depth at which the engine warns once per upward crossing
when a
Serverdoes not set its own withServerBuilder::outbound_warning_threshold.
Traits§
- File
Provider - Supplies text for resources that are not open in the editor.
- Layer
- Adds cross-cutting behavior around normalized user dispatch.
- 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§
- Request
Id - Result
- Service
Future - Boxed future returned by a user
Layer.