Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Auto-detect Rust for CodeLLDB panic breakpoints (#48236)

little Kitchene27924a2d3a8
diff --git a/crates/dap_adapters/src/codelldb.rs b/crates/dap_adapters/src/codelldb.rs
index 05aca2225aa..6c9dc0d49f9 100644
--- a/crates/dap_adapters/src/codelldb.rs
+++ b/crates/dap_adapters/src/codelldb.rs
@@ -380,6 +380,21 @@ impl DebugAdapter for CodeLldbDebugAdapter {
};
let mut json_config = config.config.clone();
+ // Auto-detect Rust projects and add sourceLanguages if not present.
+ // This enables panic breakpoints to work correctly with CodeLLDB.
+ if let Some(config_obj) = json_config.as_object_mut() {
+ if !config_obj.contains_key("sourceLanguages") {
+ // Check if this looks like a Rust binary (Cargo build output)
+ if let Some(program) = config_obj.get("program").and_then(|p| p.as_str()) {
+ let path_str = program.replace('\\', "/");
+ if path_str.contains("/target/debug/") || path_str.contains("/target/release/")
+ {
+ config_obj.insert("sourceLanguages".to_owned(), json!(["rust"]));
+ }
+ }
+ }
+ }
+
Ok(DebugAdapterBinary {
command: Some(command.unwrap()),
cwd: Some(delegate.worktree_root_path().to_path_buf()),