From 3a60420b41bfc3a1e2bb647051f966f5ee7ec667 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Fri, 30 May 2025 10:53:19 +0200 Subject: [PATCH] debugger: Fix delve-dap-shim path on Windows (#31735) Closes #ISSUE Release Notes: - debugger: Fixed wrong path being picked up for delve on Windows - debugger: Fixed delve not respecting the user-provided binary path from settings. --- crates/dap_adapters/src/go.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/dap_adapters/src/go.rs b/crates/dap_adapters/src/go.rs index 6cba3ab465..66759225f3 100644 --- a/crates/dap_adapters/src/go.rs +++ b/crates/dap_adapters/src/go.rs @@ -77,7 +77,7 @@ impl GoDebugAdapter { let path = paths::debug_adapters_dir() .join("delve-shim-dap") .join(format!("delve-shim-dap{}", asset.tag_name)) - .join("delve-shim-dap"); + .join(format!("delve-shim-dap{}", std::env::consts::EXE_SUFFIX)); self.shim_path.set(path.clone()).ok(); Ok(path) @@ -414,13 +414,15 @@ impl DebugAdapter for GoDebugAdapter { &self, delegate: &Arc, task_definition: &DebugTaskDefinition, - _user_installed_path: Option, + user_installed_path: Option, _cx: &mut AsyncApp, ) -> Result { let adapter_path = paths::debug_adapters_dir().join(&Self::ADAPTER_NAME); let dlv_path = adapter_path.join("dlv"); - let delve_path = if let Some(path) = delegate.which(OsStr::new("dlv")).await { + let delve_path = if let Some(path) = user_installed_path { + path.to_string_lossy().to_string() + } else if let Some(path) = delegate.which(OsStr::new("dlv")).await { path.to_string_lossy().to_string() } else if delegate.fs().is_file(&dlv_path).await { dlv_path.to_string_lossy().to_string()