pub enum DaemonRequest {
Initialize(InitializeRequest),
LspCall {
client_id: i64,
method: String,
params: Value,
},
GetDiagnostics {
client_id: i64,
uri: Option<Uri>,
},
QueueDiagnosticRefresh {
client_id: i64,
uri: Uri,
},
Disconnect,
Ping,
}Expand description
Messages sent from an LspClient to the LspDaemon.
The daemon protocol uses length-prefixed JSON frames over a Unix domain socket. Each frame is a 4-byte big-endian length prefix followed by a JSON-serialized DaemonRequest or DaemonResponse. The maximum frame size is MAX_MESSAGE_SIZE (16 MB).
§Request lifecycle
Client Daemon
── Initialize ──────────────►
◄─────────────── Initialized ─
── LspCall ─────────────────►
◄──────────────── LspResult ──
── GetDiagnostics ──────────►
◄──────────────── LspResult ──
── Disconnect ──────────────►§Variants
Initialize– Handshake that specifies the workspace root and language. Must be the first message. Contains anInitializeRequest.LspCall– Forward an LSP method call to the language server. Each call carries aclient_idfor response correlation.GetDiagnostics– Retrieve cached diagnostics. Passuri: Noneto get diagnostics for all files in the workspace.QueueDiagnosticRefresh– Ask the daemon to re-check a file and update its diagnostics cache.Disconnect– Graceful client disconnect.Ping– Keepalive check; the daemon responds withDaemonResponse::Pong.
§Response types
DaemonResponse variants:
Initialized– The handshake succeeded.Pong– Reply toPing.LspResult– The result of anLspCallorGetDiagnostics, containing either a JSONValueor anLspErrorResponse.Error– AProtocolErrorfor protocol-level failures.
§Helper function
extract_document_uri extracts the target file URI from an LSP request’s params, used by the daemon to auto-open documents before forwarding requests.
Variants§
Trait Implementations§
Source§impl Clone for DaemonRequest
impl Clone for DaemonRequest
Source§fn clone(&self) -> DaemonRequest
fn clone(&self) -> DaemonRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DaemonRequest
impl Debug for DaemonRequest
Source§impl<'de> Deserialize<'de> for DaemonRequest
impl<'de> Deserialize<'de> for DaemonRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl !Freeze for DaemonRequest
impl !RefUnwindSafe for DaemonRequest
impl Send for DaemonRequest
impl Sync for DaemonRequest
impl Unpin for DaemonRequest
impl UnsafeUnpin for DaemonRequest
impl UnwindSafe for DaemonRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more