Skip to content

Respect envFile property in debugpy for VSCode launch configuration - #52127

Open
nick-lehmann wants to merge 3 commits into
zed-industries:mainfrom
nick-lehmann:dap-env-file
Open

Respect envFile property in debugpy for VSCode launch configuration#52127
nick-lehmann wants to merge 3 commits into
zed-industries:mainfrom
nick-lehmann:dap-env-file

Conversation

@nick-lehmann

@nick-lehmann nick-lehmann commented Mar 22, 2026

Copy link
Copy Markdown

Context

The adapter for debugpy does not respect the envFile attribute in VSCode launch configuration.

#32984 describes the same missing behavior for Delve adapter for Go. The corresponding PR #33666 implemented a change where the location of the envFile was resolved and environment variables are injected both in the env of the DAP launch request and the process environment that launches Delve.

This workaround is necessary as Delve, debuypy and other DAP adapters do not support the envFile property.

However, this PR only implemented this for Delve and therefore only for Go. When I tried to start a debugging session for a VSCode-style python launch configuration, I ran into issues because the environment variables where missing.

This PR factors out the functionality for handling the envFile and uses it across the Delve and Debugpy implementation.

I considered implementing it for all other debuggers as well, but refrained from doing so to keep my first contribution small. If desired, I would implement it for the other debuggers as well.

If you wish for me to create an issue first for traceability, please tell me.

How to Review

I have created a small reproduction repository with a sample Python application. The main.py file simply reads the NAME env variable and prints it to stdout. It contains a .env file with said env variable. The launch configuration wires everything together.

https://github.com/nick-lehmann/zed-python-debug-repro

With the latest version of Zed, the debug configuration will yield "Hello nobody", as the NAME env variable is not provided to debugpy. With the changes in this branch, the debug configuration will correctly yield "Hello nick".

Self-Review Checklist

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • Added support for the envFile attribute in VSCode style launch configuration for python

@cla-bot

cla-bot Bot commented Mar 22, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @nick-lehmann on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@zed-codeowner-coordinator
zed-codeowner-coordinator Bot requested review from a team, Anthony-Eid and kubkon and removed request for a team March 22, 2026 11:56
@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Mar 22, 2026
@nick-lehmann

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Mar 22, 2026
@cla-bot

cla-bot Bot commented Mar 22, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@zed-industries-bot

Copy link
Copy Markdown
Contributor
Messages
📖

This PR includes links to the following GitHub Issues: #32984
If this PR aims to close an issue, please include a Closes #ISSUE line at the top of the PR body.

Generated by 🚫 dangerJS against da2f7f4

@zelenenka zelenenka removed the Size M label Apr 9, 2026
@nick-lehmann

Copy link
Copy Markdown
Author

@kubkon I am terribly sorry for the delay. I fixed the small issue that let the tests fail. I hope this PR is now ready.

@smitbarmase smitbarmase added the area:debugger/dap/debugpy Debugpy debug adapter protocol server label Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:debugger/dap/debugpy Debugpy debug adapter protocol server cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants