fix: check for invalid buffers from corrupted states#35
Conversation
Signed-off-by: sami <samiulsami7786@gmail.com>
|
Can you explain a bit more about how you're hitting this case? It should only happen if you're trying to restore a Dart session that has a filename in state, but that filename is not currently open as a buffer. The opening of that filename should be handled by the underlying session provider (mini.sessions, etc.). I'm not sure if we want to have Dart handle opening those files, but we could have it skip files that aren't already open when reading a session. |
|
Ah makes sense. But I'm loading dart's state manually like so: local cwd_hash = vim.fn.sha256(vim.fn.getcwd())
vim.api.nvim_create_autocmd("VimLeavePre", {
callback = function()
dart.write_session(cwd_hash)
end,
})
vim.api.nvim_create_autocmd("VimEnter", {
callback = function()
dart.read_session(cwd_hash)
end,
})And have configured my session manager to load only after EVERY other plugin has loaded. I've usually been hitting this issue when i'm trying to load a session that contains a marked file that i've since deleted. |
|
Yeah that tracks. I think what we should do in that case is, when loading a session (read_session), remove files from the state that are not currently open. If you'd like to take a stab at it, be my guest, otherwise I can knock it out this week. |
|
Unfortunately i cant focus on this right now, looking forward to your fix. I'll just use this fork for now and reopen if the issue persists. |
|
@samiulsami should be fixed in master now |
|
Yep, that fixed it. Thanks! |
Fixes the following error, which occurs upon loading a corrupted state/session.
