[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:
Dhruv Manilawala 2025-07-15 17:02:44 +05:30 committed by GitHub
parent 2c9da80985
commit f3a27406c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 65 deletions

View file

@ -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")?