debugger beta: Fix install detection for Debugpy in venv (#31339)

Based on my report on discord when chatting with Anthony and Remco:
https://discord.com/channels/869392257814519848/1375129714645012530

Root Cause: Zed was incorrectly trying to execute a directory path
instead of properly invoking the debugpy module when debugpy was
installed via package managers (pip, conda, etc.) rather than downloaded
from GitHub releases.

Solution:

- Automatic Detection: Zed now automatically detects whether debugpy is
installed via pip/conda or downloaded from GitHub
- Correct Invocation: For pip-installed debugpy, Zed now uses python -m
debugpy.adapter instead of trying to execute file paths
- Added a `installed_in_venv` flag to differentiate the setup properly
- Backward Compatibility: GitHub-downloaded debugpy releases continue to
work as before
- Enhanced Logging: Added logging to show which debugpy installation
method is being used (I had to verify it somehow)

I verified with the following setups (can be confirmed with the debug
logs):
- `conda` with installed debugpy, went to installed instance
- `uv` with installed debugpy, went to installed instance
- `uv` without installed debugpy, went to github releases
- Homebrew global python install, went to github releases

Release Notes:

- Fix issue where debugpy from different environments won't load as
intended
This commit is contained in:
Raphael Lüthy 2025-05-27 11:45:55 +02:00 committed by GitHub
parent 7ec61ceec9
commit 05763b2fe3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 138 additions and 27 deletions

2
Cargo.lock generated
View file

@ -4058,10 +4058,10 @@ dependencies = [
"gpui",
"json_dotpath",
"language",
"log",
"paths",
"serde",
"serde_json",
"smol",
"task",
"util",
"workspace-hack",