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

Extending python launch config not working as expected

justusschock opened this issue · comments

Hey,

First of all: Thank you very much for the great package. I really enjoy debugging with this.

However, the manual configuration of my launch config (as mentioned here) does not work for me.

I set it like this:

require('dap-python').setup('python')
require('dap-python').test_runner = 'pytest'

table.insert(require('dap').configurations.python, {
  justMyCode = false
})

But the debugger still mentions that frames have been skipped from debugging during step-in and that this may be due to the "justMyCode" option still being the default (true).
With trying to print that value, I specifically get nil. The documentations says, that I can extend the config. Does that mean, I need to provide a whole config or can I just extend this with single arguments like intended above?
Do you have any idea on why this argument is not loaded?

Thanks a lot!

table.insert adds a new configuration so yes, you'd need to provide a full configuration. If you want to add or change properties of the existing configuration you've to modify them.

If you know the index of the entry you can do something like this:

require('dap').configurations.python[1].justMyCode = false

Or you could iterate over all of them:

local configurations = require('dap').configurations.python
for _, configuration in pairs(configurations) do
  configuration.justMyCode = false
end

Thanks a lot!

Extra: if using test_method , you need to call it with the following config:

map("<leader>dm", function()
 require("dap-python").test_method({config = {justMyCode = false}})
 end)