Add messages and handlers for RPC log toggling

Co-authored-by: Ben Kunkle <ben@zed.dev>
Co-authored-by: Lukas Wirth <lukas@zed.dev>
This commit is contained in:
Kirill Bulatov 2025-08-22 20:37:31 +03:00
parent 848d1101d3
commit ab5da3af83
8 changed files with 94 additions and 51 deletions

View file

@ -65,13 +65,6 @@ impl HeadlessProject {
settings::init(cx);
language::init(cx);
project::Project::init_settings(cx);
// todo! what to do with the RPC log spam?
// if we have not enabled RPC logging on the remote client, we do not need these
//
// Maybe, add another RPC message, proto::ToggleRpcLogging(bool)
// and send it into the upstream client from the remotes, so that the local/headless counterpart
// can access this Global<LspLog> and toggle the spam send
language_tools::lsp_log::init(cx);
}
pub fn new(
@ -87,6 +80,8 @@ impl HeadlessProject {
) -> Self {
debug_adapter_extension::init(proxy.clone(), cx);
languages::init(languages.clone(), node_runtime.clone(), cx);
// todo! avoid "memory leaks" here as we do not need to gather any logs locally, just proxy the to the client
language_tools::lsp_log::init(session.clone(), cx);
let worktree_store = cx.new(|cx| {
let mut store = WorktreeStore::local(true, fs.clone());
@ -333,16 +328,6 @@ impl HeadlessProject {
})
.log_err();
}
LspStoreEvent::LanguageServerLog(language_server_id, log_type, message) => {
self.session
.send(proto::LanguageServerLog {
project_id: SSH_PROJECT_ID,
language_server_id: language_server_id.to_proto(),
message: message.clone(),
log_type: Some(log_type.to_proto()),
})
.log_err();
}
LspStoreEvent::LanguageServerPrompt(prompt) => {
let request = self.session.request(proto::LanguageServerPromptRequest {
project_id: SSH_PROJECT_ID,