Skip to content

Commit 08673a2

Browse files
Add collab host handlers
1 parent b217ecb commit 08673a2

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

crates/language_tools/src/lsp_log.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,14 @@ impl LogStore {
442442
}
443443
}
444444
}
445+
project::Event::ToggleLspLogs { server_id, enabled } => {
446+
// we do not support any other log toggling yet
447+
if *enabled {
448+
log_store.enable_rpc_trace_for_language_server(*server_id);
449+
} else {
450+
log_store.disable_rpc_trace_for_language_server(*server_id);
451+
}
452+
}
445453
_ => {}
446454
}
447455
}),

crates/project/src/project.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,10 @@ pub enum Event {
282282
buffer_abs_path: PathBuf,
283283
name: Option<LanguageServerName>,
284284
},
285+
ToggleLspLogs {
286+
server_id: LanguageServerId,
287+
enabled: bool,
288+
},
285289
Toast {
286290
notification_id: SharedString,
287291
message: String,
@@ -1002,6 +1006,7 @@ impl Project {
10021006
client.add_entity_request_handler(Self::handle_open_buffer_by_path);
10031007
client.add_entity_request_handler(Self::handle_open_new_buffer);
10041008
client.add_entity_message_handler(Self::handle_create_buffer_for_peer);
1009+
client.add_entity_message_handler(Self::handle_toggle_lsp_logs);
10051010

10061011
WorktreeStore::init(&client);
10071012
BufferStore::init(&client);
@@ -4699,6 +4704,20 @@ impl Project {
46994704
})?
47004705
}
47014706

4707+
async fn handle_toggle_lsp_logs(
4708+
project: Entity<Self>,
4709+
envelope: TypedEnvelope<proto::ToggleLspLogs>,
4710+
mut cx: AsyncApp,
4711+
) -> Result<()> {
4712+
project.update(&mut cx, |_, cx| {
4713+
cx.emit(Event::ToggleLspLogs {
4714+
server_id: LanguageServerId::from_proto(envelope.payload.server_id),
4715+
enabled: envelope.payload.enabled,
4716+
})
4717+
})?;
4718+
Ok(())
4719+
}
4720+
47024721
async fn handle_synchronize_buffers(
47034722
this: Entity<Self>,
47044723
envelope: TypedEnvelope<proto::SynchronizeBuffers>,

0 commit comments

Comments
 (0)