Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement logging for debug adapter clients #45

Merged
merged 9 commits into from
Oct 21, 2024
17 changes: 17 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ members = [
#

"tooling/xtask",
"crates/debugger_tools",
]
default-members = ["crates/zed"]

Expand Down Expand Up @@ -207,6 +208,7 @@ dap = { path = "crates/dap" }
dap_adapters = { path = "crates/dap_adapters" }
db = { path = "crates/db" }
debugger_ui = { path = "crates/debugger_ui" }
debugger_tools = { path = "crates/debugger_tools" }
dev_server_projects = { path = "crates/dev_server_projects" }
diagnostics = { path = "crates/diagnostics" }
editor = { path = "crates/editor" }
Expand Down
2 changes: 2 additions & 0 deletions crates/dap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ gpui.workspace = true
http_client.workspace = true
log.workspace = true
node_runtime.workspace = true
parking_lot.workspace = true
schemars.workspace = true
serde.workspace = true
serde_json.workspace = true
settings.workspace = true
smallvec.workspace = true
smol.workspace = true
task.workspace = true
1 change: 0 additions & 1 deletion crates/dap/src/adapters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use http_client::HttpClient;
use node_runtime::NodeRuntime;
use serde_json::Value;
use std::{collections::HashMap, ffi::OsString, path::Path, sync::Arc};

use task::DebugAdapterConfig;

pub trait DapDelegate {
Expand Down
14 changes: 13 additions & 1 deletion crates/dap/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use crate::{
adapters::{DebugAdapter, DebugAdapterBinary},
transport::TransportDelegate,
transport::{IoKind, LogKind, TransportDelegate},
};
use anyhow::{anyhow, Result};

use dap_types::{
messages::{Message, Response},
requests::Request,
Expand Down Expand Up @@ -163,4 +164,15 @@ impl DebugAdapterClient {
pub async fn shutdown(&self) -> Result<()> {
self.transport_delegate.shutdown().await
}

pub fn has_adapter_logs(&self) -> bool {
self.transport_delegate.has_adapter_logs()
}

pub fn add_log_handler<F>(&self, f: F, kind: LogKind)
where
F: 'static + Send + FnMut(IoKind, &str),
{
self.transport_delegate.add_log_handler(f, kind);
}
}
Loading
Loading