pub struct LspTransport { /* private fields */ }Expand description
Transport layer for communicating with an LSP server over stdio.
Implementations§
Source§impl LspTransport
impl LspTransport
Sourcepub fn spawn(binary: &str, args: &[&str], cwd: &Path) -> Result<Self>
pub fn spawn(binary: &str, args: &[&str], cwd: &Path) -> Result<Self>
Spawn an LSP server process and connect to its stdio.
§Errors
Returns an error if the binary cannot be spawned.
Sourcepub async fn send_request(&mut self, method: &str, params: Value) -> Result<i64>
pub async fn send_request(&mut self, method: &str, params: Value) -> Result<i64>
Send a JSON-RPC request. Returns the request ID.
§Errors
Returns an error on IO or serialization failure.
Sourcepub async fn send_notification(
&mut self,
method: &str,
params: Value,
) -> Result<()>
pub async fn send_notification( &mut self, method: &str, params: Value, ) -> Result<()>
Send a JSON-RPC notification (no response expected).
§Errors
Returns an error on IO or serialization failure.
Sourcepub async fn read_message(&mut self) -> Result<JsonRpcMessage>
pub async fn read_message(&mut self) -> Result<JsonRpcMessage>
Read the next JSON-RPC message from the server.
§Errors
Returns an error on IO, framing, or JSON parse failure.
Sourcepub async fn flush_writer(&mut self) -> Result<()>
pub async fn flush_writer(&mut self) -> Result<()>
Flush the write buffer. Call at the end of a batch of requests to avoid per-message syscall overhead.
§Errors
Returns an error on IO failure.
Auto Trait Implementations§
impl !Freeze for LspTransport
impl !RefUnwindSafe for LspTransport
impl Send for LspTransport
impl Sync for LspTransport
impl Unpin for LspTransport
impl UnsafeUnpin for LspTransport
impl !UnwindSafe for LspTransport
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more