Prevent step_into from opening file in a new tab #1162
-
If I try stepping into a function that is defined in a different file, that file is opened in a new tab instead of the existing buffer window. This basically makes the debugger unusable as all the information I need is in the watch windows of the previous tab. I'm running nvim-dap-ui but a closed issue there says that the issue is to do with nvim-dap itself. Is this default behaviour or is it being caused by some other config? Any help debugging this would be appreciated. My config is pasted below local dap, dapui = require("dap"), require("dapui")
dap.adapters.gdb = {
type = "executable",
command = "gdb",
args = { "--interpreter=dap" }
}
vim.keymap.set('n', '<F5>', function() require('dap').continue() end)
vim.keymap.set('n', '<F10>', function() require('dap').step_over() end)
vim.keymap.set('n', '<F11>', function() require('dap').step_into() end)
vim.keymap.set('n', '<F12>', function() require('dap').step_out() end)
vim.keymap.set('n', '<Leader>db', function() require('dap').toggle_breakpoint() end)
vim.keymap.set('n', '<Leader>dB', function() require('dap').set_breakpoint() end)
vim.keymap.set('n', '<Leader>dlp', function() require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) end)
vim.keymap.set('n', '<Leader>dr', function() require('dap').repl.open() end)
vim.keymap.set('n', '<Leader>dl', function() require('dap').run_last() end)
vim.keymap.set({'n', 'v'}, '<Leader>dh', function()
require('dap.ui.widgets').hover()
end)
vim.keymap.set({'n', 'v'}, '<Leader>dp', function()
require('dap.ui.widgets').preview()
end)
local cconfig = {
{
name = "Launch",
type = "gdb",
request = "launch",
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = "${workspaceFolder}",
stopAtBeginningOfMainSubprogram = false,
},
{
name = 'Attach to process (GDB)',
type = 'gdb',
request = 'attach',
processId = require('dap.utils').pick_process,
},
}
dap.configurations.c = cconfig
dap.configurations.cpp = cconfig
require("dapui").setup()
dap.listeners.before.attach.dapui_config = function()
dapui.open()
end
dap.listeners.before.launch.dapui_config = function()
dapui.open()
end
dap.listeners.before.event_terminated.dapui_config = function()
dapui.close()
end
dap.listeners.before.event_exited.dapui_config = function()
dapui.close()
end |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
See |
Beta Was this translation helpful? Give feedback.
See
switchbuf
in:help dap.defaults
. You probably want to set it to something likeusetab,uselast
.