mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-29 03:02:27 +00:00
[ty] Remove ConnectionInitializer (#19353)
## Summary This PR removes the `ConnectionInitializer` and inlines the `initialize_start` and `initialize_finish` calls. The main benefit of this is that it will allow us to use [`Connection::memory`](https://docs.rs/lsp-server/latest/lsp_server/struct.Connection.html#method.memory) in the mock server. That method returns two `Connection` where one of them will represent the client side connection and the other will be sent to the `Server::new` call to be used by the server. This way the mock client can send notifications and requests to mimic the editor. ## Test Plan I tested out the initialization process and checked that the initialized result contains the server capabilities and server info.
This commit is contained in:
parent
2c9da80985
commit
f3a27406c9
4 changed files with 24 additions and 65 deletions
|
|
@ -1,8 +1,11 @@
|
|||
use crate::server::{ConnectionInitializer, Server};
|
||||
use std::num::NonZeroUsize;
|
||||
|
||||
use anyhow::Context;
|
||||
use lsp_server::Connection;
|
||||
|
||||
use crate::server::Server;
|
||||
pub use document::{NotebookDocument, PositionEncoding, TextDocument};
|
||||
pub(crate) use session::{DocumentQuery, Session};
|
||||
use std::num::NonZeroUsize;
|
||||
|
||||
mod document;
|
||||
mod logging;
|
||||
|
|
@ -25,7 +28,7 @@ pub fn run_server() -> anyhow::Result<()> {
|
|||
.unwrap_or(four)
|
||||
.min(four);
|
||||
|
||||
let (connection, io_threads) = ConnectionInitializer::stdio();
|
||||
let (connection, io_threads) = Connection::stdio();
|
||||
|
||||
let server_result = Server::new(worker_threads, connection)
|
||||
.context("Failed to start server")?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue