pocco81 / dap-buddy.nvim

🐞 Debug Adapter Protocol manager for Neovim
GNU General Public License v3.0
399 stars 48 forks source link

Bash debugger implementation discussion #67

Open MuhammadSawalhy opened 2 years ago

MuhammadSawalhy commented 2 years ago

I have used rogalmic/vscode-bash-debug with nvim-dap to debug bash scripts. it seems that it is no longer maintained, but an unmaintained debugger is better than nothing.

Plug 'rogalmic/vscode-bash-debug', { 'do': 'npm install && npm run compile' }
dap.adapters = {
  bashdb = {
    type = "executable",
    command = "node",
    args = {vim.g.plug_home .. "/vscode-bash-debug/out/bashDebug.js"}
  },
}

local config = {
  bash = {
    {
      type = 'bashdb',
      request = 'launch',
      name = 'Launch file',
      program = '${file}',
      cwd = vim.fn.getcwd(),
      args = function()
        local args_string = vim.fn.input('Arguments: ')
        return vim.split(args_string, " +")
      end,
      env = {
        BASHDB_HOME = vim.g.plug_home .. '/vscode-bash-debug/bashdb_dir',
      },
      protocol = 'inspector',
      console = 'integratedTerminal',
      pathBashdb = vim.g.plug_home .. '/vscode-bash-debug/bashdb_dir/bashdb',
      pathBashdbLib = vim.g.plug_home .. '/vscode-bash-debug/bashdb_dir',
      pathMkfifo = 'mkfifo',
      pathPkill = 'pkill',
      pathBash = 'bash',
      pathCat = 'cat',
    },
  },
}

dap.configurations = {
  bash = config.bash,
  sh = config.bash,
}