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 default documentation is the stable LSP 3.17 surface. APIs in the
proposed module and proposed-only Client methods are explicitly
marked unstable and appear only when the proposed feature is enabled.
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 - 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.
- 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. - 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. - 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).
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
- 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
(
Client::begin_progressand the resultingProgressHandle). - RawMessage
- A validated JSON-RPC envelope with parameters and results retained as raw UTF-8 JSON bytes.
- 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). - DEFAULT_
OUTBOUND_ WARNING_ THRESHOLD - Historical name for the default outbound-message budget. New code should
configure
ResourcePolicy::max_outbound_messagesthroughServerBuilder::resource_policy.
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 - A JSON-RPC request identifier accepted by LSP.
- Result
- Result type returned by serving and Transport entry points.
- Service
Future - Boxed future returned by a user
Layer.