Skip to content

Commit e28c478

Browse files
committed
fix zed support
1 parent e154375 commit e28c478

File tree

6 files changed

+23
-3
lines changed

6 files changed

+23
-3
lines changed

src/context/emmy_new_debugger/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};
22

33
/// accpet number as integer
44
pub mod port_deserializer {
5-
use serde::{de, Deserializer};
5+
use serde::{Deserializer, de};
66
use std::fmt;
77

88
pub fn deserialize<'de, D>(deserializer: D) -> Result<u16, D::Error>

src/handler/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::error::Error;
1515
use dap::{
1616
errors::ServerError,
1717
requests::{Command, Request},
18-
responses::ResponseBody,
18+
responses::{ResponseBody, SetExceptionBreakpointsResponse},
1919
};
2020
use evaluate_request::on_evaluate_request;
2121
pub use initialize_request::on_initialize_request;
@@ -106,6 +106,13 @@ pub async fn on_request_dispatch(
106106

107107
return Ok(());
108108
}
109+
// workaround for zed
110+
Command::SetExceptionBreakpoints(_) => {
111+
let response = request.success(ResponseBody::SetExceptionBreakpoints(
112+
SetExceptionBreakpointsResponse { breakpoints: None },
113+
));
114+
context.respond(response).await;
115+
}
109116
_ => {
110117
let response = request.error("Unsupported request");
111118
context.respond(response).await;

src/handler/scopes_request.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pub async fn on_scopes_request(
1010
scopes_arguments: ScopesArguments,
1111
_: CancellationToken,
1212
) -> RequestResult {
13+
log::info!("Received Scopes request: {:#?}", scopes_arguments);
1314
let mut data = dap.data.lock().await;
1415
data.current_frame_id = scopes_arguments.frame_id;
1516
let mut scopes = vec![];

src/handler/stack_trace_request.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,15 @@ async fn find_file_path(
103103
for file_path in &file_paths {
104104
let path = Path::new(file_path);
105105
if path.exists() {
106-
let real_file_path = path.to_string_lossy().to_string();
106+
let real_file_path = if path.is_absolute() {
107+
path.to_string_lossy().to_string()
108+
} else {
109+
std::env::current_dir()
110+
.unwrap()
111+
.join(path)
112+
.to_string_lossy()
113+
.to_string()
114+
};
107115
data.file_cache
108116
.insert(chunkname.clone(), Some(real_file_path.clone()));
109117
return Ok(Some(real_file_path));

src/handler/threads_request.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::context::DapSnapShot;
66
use super::RequestResult;
77

88
pub async fn on_threads_request(_: DapSnapShot, _: (), _: CancellationToken) -> RequestResult {
9+
log::info!("Handling Threads Request");
910
Ok(ResponseBody::Threads(ThreadsResponse {
1011
threads: vec![dap::types::Thread {
1112
id: 1,

src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
1717
let cmd_args = CmdArgs::from_args();
1818

1919
init_logger(&cmd_args);
20+
let current_path = std::env::current_dir()?;
21+
log::info!("Starting path {:?}", current_path);
22+
2023
let input = BufReader::new(std::io::stdin());
2124
let output = BufWriter::new(std::io::stdout());
2225
let server = Server::new(input, output);

0 commit comments

Comments
 (0)