mfussenegger / nvim-dap-python

An extension for nvim-dap, providing default configurations for python and methods to debug individual test methods or classes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unintuitive configuration on Windows

jototland opened this issue · comments

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'

Thanks for pointing out. I changed it in #111