From 68a5351e571bdcba872e19607fc2fdfe9551ff39 Mon Sep 17 00:00:00 2001 From: AltCode Date: Tue, 12 May 2026 16:58:00 +0200 Subject: [PATCH] Detect debug adapter from `$PATH` --- src/language_servers/elixir_ls.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/language_servers/elixir_ls.rs b/src/language_servers/elixir_ls.rs index d8e3bae..89fb9c3 100644 --- a/src/language_servers/elixir_ls.rs +++ b/src/language_servers/elixir_ls.rs @@ -23,6 +23,7 @@ pub struct ElixirLs { impl ElixirLs { pub const LANGUAGE_SERVER_ID: &'static str = "elixir-ls"; pub const DEBUG_ADAPTER_NAME: &'static str = "ElixirLS"; + const DEBUG_ADAPTER_BINARY_NAME: &'static str = "elixir-debug-adapter"; pub fn new() -> Self { Self { @@ -323,9 +324,9 @@ impl ElixirLs { &mut self, config: DebugTaskDefinition, user_provided_debug_adapter_path: Option, - _worktree: &Worktree, + worktree: &Worktree, ) -> Result { - let elixir_ls = self.debug_adapter_binary(user_provided_debug_adapter_path)?; + let elixir_ls = self.debug_adapter_binary(user_provided_debug_adapter_path, worktree)?; let request = self .dap_request_kind( @@ -350,11 +351,16 @@ impl ElixirLs { fn debug_adapter_binary( &mut self, user_provided_debug_adapter_path: Option, + worktree: &Worktree, ) -> Result { if let Some(binary_path) = user_provided_debug_adapter_path { return Ok(binary_path); } + if let Some(binary_path) = worktree.which(Self::DEBUG_ADAPTER_BINARY_NAME) { + return Ok(binary_path); + } + if let Some(binary_path) = &self.cached_dap_binary_path && fs::metadata(binary_path).is_ok_and(|stat| stat.is_file()) {