Absolutize LSP and DAP paths more conservatively (#42482)

Fixes a regression caused by #42135 where LSP and DAP binaries weren't
being used from `PATH` env var

Now we absolutize the path if (path is relative AND (path has multiple
components OR path exists in worktree)).

- Relative paths with multiple components might not exist in the
worktree because they are ignored. Paths with a single component will at
least have an entry saying that they exist and are ignored.
- Relative paths with multiple components will never use the `PATH` env
var, so they can be safely absolutized

Release Notes:

- N/A
This commit is contained in:
Andrew Farkas
2025-11-12 01:36:22 +00:00
committed by GitHub
parent cf6ae01d07
commit 2bcfc12951
5 changed files with 52 additions and 10 deletions
+2 -2
View File
@@ -262,8 +262,8 @@ impl DapStore {
let user_installed_path = dap_settings.and_then(|s| match &s.binary {
DapBinary::Default => None,
DapBinary::Custom(binary) => {
// if `binary` is absolute, `.join()` will keep it unmodified
Some(worktree.read(cx).abs_path().join(PathBuf::from(binary)))
let path = PathBuf::from(binary);
Some(worktree.read(cx).resolve_executable_path(path))
}
});
let user_args = dap_settings.map(|s| s.args.clone());