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

type python deprecated in favor of debugpy #129

Closed niderhoff closed 9 months ago

niderhoff commented 9 months ago

Hi, in the newest versions of vscode the type for a python launch configuration is represented as "debugpy" instead of "python".

image

Previously (deprecated):

        {
            "name": "Python Debugger: Current File",
            "type": "python",       <-----------
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": false
        }

New:

        {
            "name": "Python Debugger: Current File",
            "type": "debugpy",       <-----------
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": false
        }

So by default they will be attached to the wrong file type if we import the launch.json using nvim-dap, i.e. they are not aviailable in the launch menu of nvim-dap. However, we may redirect them to python instead, so they show up in the Launch menu:

  require('dap.ext.vscode').load_launchjs(".vscode/launch.json", { debugpy = {'python'} })

Now they show up -- but -- if we launch any of them nvim-dap will complain that no adapter is installed for "debugpy", because nvim-dap-python registers only a "python" adapter not a "debugpy" adapter.

image

With the prospect of launch.json coming out of vscode projects in the future using the type-declarator "debugpy", wouldn't it make sense to support both in nvim-dap-python as well?

mfussenegger commented 9 months ago

Can you try with https://github.com/mfussenegger/nvim-dap-python/pull/130 ?

niderhoff commented 9 months ago

yes, I can confirm it works :)