Skip to content

Commit 1f411dd

Browse files
samwgoldmanmeta-codesync[bot]
authored andcommitted
Simplify dispatch_lsp_events parameter
Summary: Instead of accepting an impl, take &Server and add to the TspInterface for TSP. Reviewed By: grievejia Differential Revision: D92800157 fbshipit-source-id: 9e81dbd2faa4e04276d2b89969d84fc192296a4f
1 parent cd08867 commit 1f411dd

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

pyrefly/lib/lsp/non_wasm/server.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ pub trait TspInterface: Send + Sync {
353353

354354
fn stop_recheck_queue(&self);
355355

356+
fn dispatch_lsp_events(&self);
357+
356358
/// Process an LSP event and return the next step
357359
fn process_event<'a>(
358360
&'a self,
@@ -740,7 +742,7 @@ pub fn initialize_finish<C: Serialize>(
740742
/// - priority_events includes those that should be handled as soon as possible (e.g. know that a
741743
/// request is cancelled)
742744
/// - queued_events includes most of the other events.
743-
pub fn dispatch_lsp_events(server: &impl TspInterface) {
745+
pub fn dispatch_lsp_events(server: &Server) {
744746
for msg in &server.connection().receiver {
745747
match msg {
746748
Message::Request(x) => {
@@ -4812,6 +4814,10 @@ impl TspInterface for Server {
48124814
&self.pending_watched_file_changes
48134815
}
48144816

4817+
fn dispatch_lsp_events(&self) {
4818+
dispatch_lsp_events(self);
4819+
}
4820+
48154821
fn run_recheck_queue(&self, telemetry: &impl Telemetry) {
48164822
self.recheck_queue.run_until_stopped(self, telemetry);
48174823
}

pyrefly/lib/tsp/server.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use crate::lsp::non_wasm::server::ProcessEvent;
2626
use crate::lsp::non_wasm::server::ServerCapabilitiesWithTypeHierarchy;
2727
use crate::lsp::non_wasm::server::TspInterface;
2828
use crate::lsp::non_wasm::server::capabilities;
29-
use crate::lsp::non_wasm::server::dispatch_lsp_events;
3029
use crate::lsp::non_wasm::transaction_manager::TransactionManager;
3130

3231
/// TSP server that delegates to LSP server infrastructure while handling only TSP requests
@@ -149,7 +148,7 @@ pub fn tsp_loop(
149148
scope.spawn(|| server.inner.run_recheck_queue(telemetry));
150149

151150
scope.spawn(|| {
152-
dispatch_lsp_events(&server.inner);
151+
server.inner.dispatch_lsp_events();
153152
});
154153

155154
let mut ide_transaction_manager = TransactionManager::default();

0 commit comments

Comments
 (0)