Weissle / persistent-breakpoints.nvim

Neovim plugin for persistent breakpoints.
MIT License
185 stars 8 forks source link

breakpoints not showing up when loading file after quitting #15

Closed jay-babu closed 1 year ago

jay-babu commented 1 year ago

-- after restarting neovim. no lines have a breakpoint visible image

-- saved breakpoints image

jay-babu commented 1 year ago

image

breakpoints do show up when doing set_breakpoints, which actually resets the saved file: image

jay-babu commented 1 year ago

https://github.com/Weissle/persistent-breakpoints.nvim/commit/a6091f7486bb6fe0cb11f5afde7f426e426aa233

manually calling this function seems to work: require("persistent-breakpoints.api").reload_breakpoints

jay-babu commented 1 year ago

using lazy.nvim

return {
  "Weissle/persistent-breakpoints.nvim",
  opts = function(_, opts)
    return require("astronvim.utils").extend_tbl(opts, {
      load_breakpoints_event = { "BufReadPost" },
    })
  end,
  keys = {
    {
      "<leader>db",
      function() require("persistent-breakpoints.api").toggle_breakpoint() end,
      { silent = true },
      desc = "Toggle Breakpoint",
    },
    {
      "<leader>dB",
      function() require("persistent-breakpoints.api").clear_all_breakpoints() end,
      { silent = true },
      desc = "Clear Breakpoints",
    },
    {
      "<leader>dC",
      function() require("persistent-breakpoints.api").set_conditional_breakpoint() end,
      { silent = true },
      desc = "Conditional Breakpoint",
    },
  },
}
jay-babu commented 1 year ago
  event = "BufReadPost",

was missing this to load the plugin

qizidog commented 1 year ago

For LazyVim users:

{
  "Weissle/persistent-breakpoints.nvim",
  dependencies = {
    {
      "mfussenegger/nvim-dap",
      keys = {
        { "<leader>db", false },
        { "<leader>dB", false },
      },
    },
  },
  event = "BufReadPost",
  opts = {
    save_dir = vim.fn.stdpath("data") .. "/nvim_checkpoints",
    -- when to load the breakpoints? "BufReadPost" is recommanded.
    load_breakpoints_event = "BufReadPost",
    -- load_breakpoints_event = nil,
    -- record the performance of different function. run :lua require('persistent-breakpoints.api').print_perf_data() to see the result.
    perf_record = false,
    -- perform callback when loading a persisted breakpoint
    -- @param opts DAPBreakpointOptions options used to create the breakpoint ({condition, logMessage, hitCondition})
    -- @param buf_id integer the buffer the breakpoint was set on
    -- @param line integer the line the breakpoint was set on
    on_load_breakpoint = nil,
  },
  keys = {
    {
      "<leader>db",
      function()
        require("persistent-breakpoints.api").toggle_breakpoint()
      end,
      silent = true,
      desc = "Toggle-Breakpoint",
      remap = false,
    },
    {
      "<leader>dB",
      function()
        require("persistent-breakpoints.api").set_conditional_breakpoint()
      end,
      silent = true,
      desc = "Conditional-Breakpoint",
      remap = false,
    },
  },
}