debugger: Filter out debug scenarios with invalid Adapters from debug picker (#35744)
I also removed a debug assertion that wasn't true when a debug session was restarting through a request, because there wasn't a booting task Zed needed to run before the session. I renamed SessionState::Building to SessionState::Booting as well, because building implies that we're building code while booting the session covers more cases and is more accurate. Release Notes: - debugger: Filter out more invalid debug configurations from the debug picker Co-authored-by: Remco Smits <djsmits12@gmail.com>
This commit is contained in:
parent
a5dd8d0052
commit
3ea90e397b
7 changed files with 38 additions and 27 deletions
|
@ -300,7 +300,7 @@ impl DebugPanel {
|
|||
});
|
||||
|
||||
session.update(cx, |session, _| match &mut session.mode {
|
||||
SessionState::Building(state_task) => {
|
||||
SessionState::Booting(state_task) => {
|
||||
*state_task = Some(boot_task);
|
||||
}
|
||||
SessionState::Running(_) => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use anyhow::{Context as _, bail};
|
||||
use collections::{FxHashMap, HashMap};
|
||||
use collections::{FxHashMap, HashMap, HashSet};
|
||||
use language::LanguageRegistry;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
|
@ -450,7 +450,7 @@ impl NewProcessModal {
|
|||
.and_then(|buffer| buffer.read(cx).language())
|
||||
.cloned();
|
||||
|
||||
let mut available_adapters = workspace
|
||||
let mut available_adapters: Vec<_> = workspace
|
||||
.update(cx, |_, cx| DapRegistry::global(cx).enumerate_adapters())
|
||||
.unwrap_or_default();
|
||||
if let Some(language) = active_buffer_language {
|
||||
|
@ -1054,6 +1054,9 @@ impl DebugDelegate {
|
|||
})
|
||||
})
|
||||
});
|
||||
|
||||
let valid_adapters: HashSet<_> = cx.global::<DapRegistry>().enumerate_adapters();
|
||||
|
||||
cx.spawn(async move |this, cx| {
|
||||
let (recent, scenarios) = if let Some(task) = task {
|
||||
task.await
|
||||
|
@ -1094,6 +1097,7 @@ impl DebugDelegate {
|
|||
} => !(hide_vscode && dir.ends_with(".vscode")),
|
||||
_ => true,
|
||||
})
|
||||
.filter(|(_, scenario)| valid_adapters.contains(&scenario.adapter))
|
||||
.map(|(kind, scenario)| {
|
||||
let (language, scenario) =
|
||||
Self::get_scenario_kind(&languages, &dap_registry, scenario);
|
||||
|
|
|
@ -1651,7 +1651,7 @@ impl RunningState {
|
|||
|
||||
let is_building = self.session.update(cx, |session, cx| {
|
||||
session.shutdown(cx).detach();
|
||||
matches!(session.mode, session::SessionState::Building(_))
|
||||
matches!(session.mode, session::SessionState::Booting(_))
|
||||
});
|
||||
|
||||
if is_building {
|
||||
|
|
|
@ -298,7 +298,7 @@ async fn test_dap_adapter_config_conversion_and_validation(cx: &mut TestAppConte
|
|||
|
||||
let adapter_names = cx.update(|cx| {
|
||||
let registry = DapRegistry::global(cx);
|
||||
registry.enumerate_adapters()
|
||||
registry.enumerate_adapters::<Vec<_>>()
|
||||
});
|
||||
|
||||
let zed_config = ZedDebugConfig {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue