Skip to content

Commit

Permalink
Check if adapter is already installed before installing one
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony-Eid committed Oct 23, 2024
1 parent fb3375c commit 62fd388
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions crates/project/src/dap_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,17 +250,22 @@ impl DapStore {
.context("Creating debug adapter")
.log_err()?,
);
let _ = adapter
.install_binary(&adapter_delegate)
.await
.context("Failed to install debug adapter binary")
.log_err()?;

let binary = adapter
.fetch_binary(&adapter_delegate, &config)
.await
.context("Failed to get debug adapter binary")
.log_err()?;
let mut binary = adapter.fetch_binary(&adapter_delegate, &config).await.ok();

if binary.is_none() {
let _ = adapter
.install_binary(&adapter_delegate)
.await
.context("Failed to install debug adapter binary")
.log_err()?;

binary = adapter
.fetch_binary(&adapter_delegate, &config)
.await
.context("Failed to get debug adapter binary")
.log_err();
}

let mut request_args = json!({});
if let Some(config_args) = config.initialize_args.clone() {
Expand All @@ -277,7 +282,7 @@ impl DapStore {

client
.start(
&binary,
&binary?,
move |message, cx| {
dap_store
.update(cx, |_, cx| {
Expand Down

0 comments on commit 62fd388

Please sign in to comment.