fix(ftplugin/c): Setup debugger only if the executable exists
Removed redundant `load_launchjs` as the plugin loads it automatically
This commit is contained in:
parent
b09c001954
commit
b2f592d529
1 changed files with 46 additions and 40 deletions
|
@ -28,16 +28,21 @@ local conf = require("telescope.config").values
|
||||||
local actions = require("telescope.actions")
|
local actions = require("telescope.actions")
|
||||||
local action_state = require("telescope.actions.state")
|
local action_state = require("telescope.actions.state")
|
||||||
|
|
||||||
if require('user.file_exists').file_exists(vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]) .. "/.vscode/launch.json") then
|
if vim.fn.executable('gdb') == 1 then
|
||||||
require("dap.ext.vscode").load_launchjs(nil, { cppdbg = { "c", "cpp", "asm" } })
|
|
||||||
end
|
|
||||||
|
|
||||||
dap.adapters.gdb = {
|
dap.adapters.gdb = {
|
||||||
type = "executable",
|
type = "executable",
|
||||||
command = "gdb",
|
command = "gdb",
|
||||||
args = { "-i", "dap" }
|
args = { "-i", "dap" }
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- DAP loads this automatically as of now. May be needed to load the debugger for asm?
|
||||||
|
-- if require('user.file_exists').file_exists(vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]) .. "/.vscode/launch.json") then
|
||||||
|
-- require("dap.ext.vscode").load_launchjs(nil, { cppdbg = { "c", "cpp", "asm" } })
|
||||||
|
-- require("dap.ext.vscode").load_launchjs(nil, { gdb = { "c", "cpp", "asm" } })
|
||||||
|
-- end
|
||||||
|
|
||||||
|
if vim.fn.executable('OpenDebugAD7') == 1 then
|
||||||
dap.adapters.cppdbg = {
|
dap.adapters.cppdbg = {
|
||||||
id = 'cppdbg',
|
id = 'cppdbg',
|
||||||
type = 'executable',
|
type = 'executable',
|
||||||
|
@ -72,3 +77,4 @@ dap.configurations.c = {
|
||||||
stopAtBeginningOfMainSubprogram = true,
|
stopAtBeginningOfMainSubprogram = true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in a new issue