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

unintuitive configuration on Windows #110

Closed jototland closed 1 year ago

jototland commented 1 year ago

I had a problem running under windows. No matter what I did, my custom python environment was ignored.

Eventually I found out why: In the setup() method, there is the following line

adapter_python_path = adapter_python_path and vim.fn.expand(vim.fn.trim(adapter_python_path)) or 'python3'

In my config, I called setup with first argument: "C:\\Users\\myself\\AppData\\Local\\nvim-data/mason/packages/debugpy/venv/Scripts/python.exe"

Vims expand()-function, uses option wildignore unless the second argument nosuf is truthy. I rarely edit .exe files, so naturally I have wildignore containing *.exe in my config.

This means that whenever you pass a filename with .exe-suffix, vims expand() returns an empty string. And adapter_python_path is set to python3 instead of the full path I passed as first argument.

I propose that this line in setup() is changed to:

adapter_python_path = adapter_python_path and vim.fn.expand(vim.fn.trim(adapter_python_path),1) or 'python3'
mfussenegger commented 1 year ago

Thanks for pointing out. I changed it in https://github.com/mfussenegger/nvim-dap-python/pull/111