pub struct Connection {
    pub sender: Sender<Message>,
    pub receiver: Receiver<Message>,
}
Expand description

Connection is just a pair of channels of LSP messages.

Fields

sender: Sender<Message>receiver: Receiver<Message>

Implementations

Create connection over standard in/standard out.

Use this to create a real language server.

Open a connection over tcp. This call blocks until a connection is established.

Listen for a connection over tcp. This call blocks until a connection is established.

Creates a pair of connected connections in memory for testing.

Initialize the connection. Sends the server initialize response to the client and returns the serialized client capabilities on success. If more fine-grained initialization is required use initialize_start/initialize_finish.

Example
use std::error::Error;
use build_server_protocol::types::InitializeBuildResult;
use build_server_protocol::server::{Connection, Message, Request, RequestId, Response};

fn main() -> Result<(), Box<dyn Error + Sync + Send>> {
   // Create the transport
   let (conn, io_threads) = Connection::stdio();

   // Run the server
   conn.initialize(|_params| {
       Ok(InitializeBuildResult::new_simple(
        "MyBuildServer",
        "0.1",
        "2.0",
        ServerCapabilities::default()))
   })?;

   // ... Run main loop ...

   Ok(())
}

If req is Shutdown, respond to it and return true, otherwise return false

delegates to self.sender

delegates to self.sender

delegates to self.sender

delegates to self.sender

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more