extension: Add debug_adapters to extension manifest (#30676)

Also pass worktree to the get_dap_binary.

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-05-20 11:01:33 +02:00 committed by GitHub
parent b1c7fa1dac
commit a092e2dc03
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 147 additions and 59 deletions

View file

@ -52,26 +52,26 @@ impl PythonDebugAdapter {
}
async fn fetch_latest_adapter_version(
&self,
delegate: &dyn DapDelegate,
delegate: &Arc<dyn DapDelegate>,
) -> Result<AdapterVersion> {
let github_repo = GithubRepo {
repo_name: Self::ADAPTER_PACKAGE_NAME.into(),
repo_owner: "microsoft".into(),
};
adapters::fetch_latest_adapter_version_from_github(github_repo, delegate).await
adapters::fetch_latest_adapter_version_from_github(github_repo, delegate.as_ref()).await
}
async fn install_binary(
&self,
version: AdapterVersion,
delegate: &dyn DapDelegate,
delegate: &Arc<dyn DapDelegate>,
) -> Result<()> {
let version_path = adapters::download_adapter_from_github(
self.name(),
version,
adapters::DownloadedFileType::Zip,
delegate,
delegate.as_ref(),
)
.await?;
@ -93,7 +93,7 @@ impl PythonDebugAdapter {
async fn get_installed_binary(
&self,
delegate: &dyn DapDelegate,
delegate: &Arc<dyn DapDelegate>,
config: &DebugTaskDefinition,
user_installed_path: Option<PathBuf>,
cx: &mut AsyncApp,
@ -128,14 +128,18 @@ impl PythonDebugAdapter {
let python_path = if let Some(toolchain) = toolchain {
Some(toolchain.path.to_string())
} else {
BINARY_NAMES
.iter()
.filter_map(|cmd| {
delegate
.which(OsStr::new(cmd))
.map(|path| path.to_string_lossy().to_string())
})
.find(|_| true)
let mut name = None;
for cmd in BINARY_NAMES {
name = delegate
.which(OsStr::new(cmd))
.await
.map(|path| path.to_string_lossy().to_string());
if name.is_some() {
break;
}
}
name
};
Ok(DebugAdapterBinary {
@ -172,7 +176,7 @@ impl DebugAdapter for PythonDebugAdapter {
async fn get_binary(
&self,
delegate: &dyn DapDelegate,
delegate: &Arc<dyn DapDelegate>,
config: &DebugTaskDefinition,
user_installed_path: Option<PathBuf>,
cx: &mut AsyncApp,