-
Notifications
You must be signed in to change notification settings - Fork 27
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
allowed_dirs and ignored_dirs not working #146
Comments
@kohane27 - This should now be fixed. Thanks for flagging. |
Hello @olimorris , thank you for getting back to me. return {
"olimorris/persisted.nvim",
lazy = false,
opts = {
autoload = true,
on_autoload_no_session = function()
vim.notify("No existing session to load.")
end,
follow_cwd = false,
ignored_dirs = {
{ vim.fn.hostname(), exact = true },
{ "/", exact = true },
},
},
} I updated |
Can you share a |
Just popping in to say I am seeing the same issue. Here is a minimal config that I have verified recreates the issue on my machine local root = "/tmp/persisted"
-- Set stdpaths to use root dir
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- Bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
vim.opt.sessionoptions = "buffers,curdir,folds,globals,tabpages,winpos,winsize" -- Session options to store in the session
-- Install plugins
local plugins = {
{
"olimorris/persisted.nvim",
opts = {
-- Your custom config here
use_git_branch = true,
should_autosave = true,
autostart = true,
autoload = true,
ignored_dirs = {
"/tmp",
}
}
},
-- Put any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
}) Further, if you load this config and then print the contents of So its almost like not only is persisted not loading the existing session, but its not tracking the session either. |
I have a theory on what's going on here. The function being called here utils.lua#L28-L52 returns I think some better safeguards need to be put in place for situations where a user is blacklisting directories instead of whitelisting them. In its current state, I imagine that As a test, consider adding the following to tests/dirs_spec.lua it("can handle only ignore directories", function()
local cwd = "~/Code/Neovim/persisted.nvim"
local ignored_dirs = { { "/tmp" } }
local allowed_dirs = {}
local allowed_match = utils.dirs_match(cwd, allowed_dirs)
local ignored_match = utils.dirs_match(cwd, ignored_dirs)
assert.equals(true, allowed_match and not ignored_match)
end) This test (currently) should fail and this test is exactly what I am seeing in my config. I assume also what @kohane27 is seeing as well. |
@kohane27 - I've moved this to an issue
Thank you for informing us of the changes and decisions; and most importantly, maintaining this great plugin of yours. I really love the
autoload
feature.After updating this plugin today, I have the following problem:
If I uncomment the
-- BUG
part forignored_dirs
: the autoload feature is not working until I runSessionLoad
.If I uncomment the
-- BUG
part forautocmd
: I am met with the following error:I have read this note and have no idea why it broke. Hopefully this help. Thank you!
Originally posted by @kohane27 in #145 (comment)
The text was updated successfully, but these errors were encountered: