debugger: Do not include Rust in default value for sourceLanguages (CodeLLDB config) (#33670)

- **debugger: Update exception breakpoints list on capability update**
- **Do not prefill codelldb sourcelanguages by default**

Release Notes:

- debugger: CodeLLDB no longer enables pretty-printers for Rust by
default. This fixes pretty-printers for C++. This is a breaking change
for user-defined debug scenarios from debug.json; in order to enable
Rust pretty printing when using CodeLLDB, add `"sourceLanguages":
["rust"]` to your debug configuration. This change does not affect
scenarios automatically inferred by Zed.

---------

Co-authored-by: Anthony Eid <anthony@zed.dev>
This commit is contained in:
Piotr Osiewicz 2025-07-01 13:03:40 +02:00 committed by GitHub
parent bff5d85ff4
commit 2caa19214b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 90 additions and 21 deletions

View file

@ -2,7 +2,7 @@ use anyhow::{Context as _, Result};
use async_trait::async_trait;
use dap::{DapLocator, DebugRequest, adapters::DebugAdapterName};
use gpui::SharedString;
use serde_json::Value;
use serde_json::{Value, json};
use smol::{
io::AsyncReadExt,
process::{Command, Stdio},
@ -76,6 +76,13 @@ impl DapLocator for CargoLocator {
_ => {}
}
let config = if adapter.as_ref() == "CodeLLDB" {
json!({
"sourceLanguages": ["rust"]
})
} else {
Value::Null
};
Some(DebugScenario {
adapter: adapter.0.clone(),
label: resolved_label.to_string().into(),
@ -83,7 +90,7 @@ impl DapLocator for CargoLocator {
task_template,
locator_name: Some(self.name()),
}),
config: serde_json::Value::Null,
config,
tcp_connection: None,
})
}

View file

@ -1479,6 +1479,28 @@ impl Session {
}
Events::Capabilities(event) => {
self.capabilities = self.capabilities.merge(event.capabilities);
// The adapter might've enabled new exception breakpoints (or disabled existing ones).
let recent_filters = self
.capabilities
.exception_breakpoint_filters
.iter()
.flatten()
.map(|filter| (filter.filter.clone(), filter.clone()))
.collect::<BTreeMap<_, _>>();
for filter in recent_filters.values() {
let default = filter.default.unwrap_or_default();
self.exception_breakpoints
.entry(filter.filter.clone())
.or_insert_with(|| (filter.clone(), default));
}
self.exception_breakpoints
.retain(|k, _| recent_filters.contains_key(k));
if self.is_started() {
self.send_exception_breakpoints(cx);
}
// Remove the ones that no longer exist.
cx.notify();
}
Events::Memory(_) => {}