Skip to content

Neovim Plugin that provides some convenience functions for nicer debugging

License

Notifications You must be signed in to change notification settings

daic0r/dap-helper.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

dap-helper

Neovim Plugin that provides some convenience functions for nicer debugging with nvim-dap and nvim-dap-ui, such as:

  • Easy modification of command line arguments passed to the debuggee
  • Saving/restoring of breakpoints and watches across sessions

Installation

lazy.nvim

{
  'daic0r/dap-helper.nvim',
  dependencies = { "rcarriga/nvim-dap-ui", "mfussenegger/nvim-dap" },
  config = function()
    require("dap-helper").setup()
  end
}

Usage

Breakpoints and watches are saved automatically when a buffer is unloaded and read in once a file is loaded into a buffer.

To edit command line arguments passed during program launch run :DapHelperSetLaunchArgs.

The plugin tries to determine a project's base directory by attempting to locate a .git directory. Command line arguments will always be associated with that folder, i.e. if you launch Neovim from a subdirectory of your project, the arguments can still be found. If no .git. directory is present, the arguments will be associated with the current working directory.

To reset the stored data, you can run :DapHelperReset.

To edit the build command (command run before starting debugging) run :DapHelperSetBuildCommand. The value saved here can later be queried by require"dap-helper".get_build_cmd().

Example

local dap_helper = require"dap-helper"
vim.keymap.set("n", "<F5>", function()
   -- Check if debuggger is already running
   if #dap.status() == 0 and dap_helper.get_build_cmd() then
      local ret = os.execute(dap_helper.get_build_cmd() .. " > /dev/null 2>&1")
      if ret ~= 0 then
         vim.notify("Build failed", vim.log.levels.ERROR)
         return
      end
   end
   dap.continue()
end)

About

Neovim Plugin that provides some convenience functions for nicer debugging

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages