-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't work well with sessions #24
Comments
I am using "rmagatti/auto-session" and having the same issue. |
please provide a minimal config to re-produce the bug. |
Here is the config to reproduce {
"Weissle/persistent-breakpoints.nvim",
config = function()
require("persistent-breakpoints").setup({ load_breakpoints_event = { "BufReadPost" } })
end,
keys = {
{
"<leader>db",
function()
require("persistent-breakpoints.api").toggle_breakpoint()
end,
desc = "Set breakpoint",
},
{
"<leader>dB",
function()
require("persistent-breakpoints.api").toggle_breakpoint()
end,
desc = "Clear breakpoints",
},
{
"<leader>dp",
function()
require("persistent-breakpoints.api").set_log_point()
end,
desc = "Print point",
},
{
"<leader>dC",
function()
require("persistent-breakpoints.api").set_conditional_breakpoint()
end,
desc = "Breakpoint Condition",
},
},
},
{
"rmagatti/auto-session",
lazy = false,
config = function()
require("auto-session").setup({
auto_session_suppress_dirs = { "~/config", "~/repos" },
})
end,
} But I already solved it by using daic0r/dap-helper.nvim instead {
"daic0r/dap-helper.nvim",
dependencies = { "rcarriga/nvim-dap-ui", "mfussenegger/nvim-dap" },
config = function()
require("dap-helper").setup()
end,
} You can see the full change here TendonT52/.config@567a48d |
Thanks this worked for me |
I also encountered this, just by opening multiple files at a time (either as tab pages or windows). So this bug affects more than just sessions. In local vim = vim
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec = {
{
'mfussenegger/nvim-dap', -- Debug Adapter Protocol (DAP) client.
dependencies = { 'Joakker/lua-json5', },
config = function()
-- Read DAP configuration from ".vscode/launch.json", if it exists. Provided by nvim-dap.
require('dap.ext.vscode').load_launchjs(nil, {})
end,
},
{
'Weissle/persistent-breakpoints.nvim', -- save breakpoints between sessions.
opts = {
load_breakpoints_event = { "BufReadPost" },
-- Breakpoints are saved in the following directory.
save_dir = vim.fn.stdpath("data") .. "/persistent_breakpoints",
}
},
},
}) Then start neovim with either |
I'm pretty happy with the following workaround: return {
'Weissle/persistent-breakpoints.nvim',
-- ...
keys = {
{
'<leader>d,',
function()
require('persistent-breakpoints.api').reload_breakpoints()
-- Reopen DAP UI to update breakpoint list (it won't happen automatically)
require('dapui').toggle()
require('dapui').toggle()
end,
desc = 'Reload breakpoints',
},
},
} If I open DAP UI and see that the breakpoint I'm interested in doesn't doesn't have a line number, I open that file and use the specified binding to reload the breakpoints. It's a bit of extra work, but not much. I understand though if it's not a sufficient solution for everyone, especially if you have multiple breakpoints and you'd like all of them to work after closing and reopening the editor. |
The problem I have is when I have
buffers
insessionoptions
and save/restore a session with some buffers having breakpoints. Apparently, upon restoring session neovim adds buffers to your buffer list, but doesn't load their contents. And so whenbreakpoints.set
is called with a line number, the breakpoint ends up at the beginning of the file. I've tried variousBuf*
events in the config.Could we somehow add code that loads the related buffers before setting the breakpoints in them?
I replicated this by adding a breakpoint to a file, navigating to another file, then
:mksession!
, close neovim, open neovim,:source Session.vim
and navigating back to the file with a breakpointThe text was updated successfully, but these errors were encountered: