mfussenegger / nvim-dap-python

An extension for nvim-dap, providing default configurations for python and methods to debug individual test methods or classes.
GNU General Public License v3.0
571 stars 51 forks source link

Debugger current working directory #108

Closed Alighorab closed 1 year ago

Alighorab commented 1 year ago

I'm trying to debug a file inside a project with this layout and my neovim working directory is .. When I try to debug the file the working directory changes to the directory containing the file, so I get an error when I access a file with a relative path so to fix this I open the repl and change the directory using os.chdir("..") , is there any way to make the debugger cwd matches neovim cwd? I tried setting cwd in the configuration to ${workingDirectory} and vim.fn.getcwd() but it did not solve my issue.

.
├── project
│  └── somefile.py
├── poetry.lock
├── pyproject.toml
└── README.md
mfussenegger commented 1 year ago

When I try to debug the file the working directory changes to the directory containing the file

nvim-dap or nvim-dap-python don't change the working directory and the working directory for the debug adapter defaults to the working directory of neovim. The working directory of the program to debug can be set via the cwd option, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings

You could have a look at the logs to see what's actually sent.