debugger: Show language icons in debug scenario picker (#30662)

We attempt to resolve the language name in this order

1. Based on debug adapter if they're for a singular language e.g. Delve
2. File extension if it exists
3. If a language name exists within a debug scenario's label

In the future I want to use locators to also determine the language as
well and refresh scenario list when a new scenario has been saved

Release Notes:

- N/A
This commit is contained in:
Anthony Eid 2025-05-14 00:50:58 +02:00 committed by GitHub
parent 9826b7b5c1
commit f1fe505649
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 115 additions and 14 deletions

View file

@ -2,6 +2,7 @@ use anyhow::Result;
use async_trait::async_trait;
use collections::FxHashMap;
use gpui::{App, Global, SharedString};
use language::LanguageName;
use parking_lot::RwLock;
use task::{DebugRequest, DebugScenario, SpawnInTerminal, TaskTemplate};
@ -59,6 +60,11 @@ impl DapRegistry {
);
}
pub fn adapter_language(&self, adapter_name: &str) -> Option<LanguageName> {
self.adapter(adapter_name)
.and_then(|adapter| adapter.adapter_language_name())
}
pub fn add_locator(&self, locator: Arc<dyn DapLocator>) {
let _previous_value = self.0.write().locators.insert(locator.name(), locator);
debug_assert!(