auto-session
auto-session copied to clipboard
[BUG] When attempting to load via Autosession search, it cannot find directory
Describe the bug
When running Autosession search
I get to pick between my 2 currently existing session. Picking ether of them, however, errors out with the following:
Notably, this does not happen when using session-lens, so I feel like it may have potentially sneaked under the radar.
To Reproduce Steps to reproduce the behavior:
- Uninstall session-lens and disable the telescope plugin.
- (Perhaps uninstall dressing as well, however, it repros for me with it too)
- Restart vim
- Go to a valid directory, open a few buffers, save a session
- Run
Autosession search
and pick the new one - See error.
Expected behavior The app restores the session smoothly.
Baseline (please complete the following information):
- Result of
set sessionoptions?
:sessionoptions=blank,buffers,curdir,folds,help,tabpages,winsize,terminal,localoptions,winpos
- OS. e.g
uname -a
:MSYS_NT-10.0-22621 PC-Name 3.3.6-341.x86_64 2022-09-05 20:28 UTC x86_64 Msys
(win 11) - Neovim version
nvim --version
NVIM v0.9.0-dev-417+g1390e97c2
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compiled by runneradmin@fv-az153-379
Additional context Also, Autosession delete does not delete the session for me ether. Feel like that might be related.
Hey, this is an interesting one. At first glance it looks to me like it's an error with your config regarding vim.ui.select
but I'm not super sure how exactly this would happen
If I can provide and logs or further info, please do say 👍
Having the same with just this setup:
require("auto-session").setup({
log_level = "error",
auto_session_enable_last_session = true,
})
Maybe its a windows thing?
Does vim.ui.select
itself work for any of you?
To check, put this code into a lua file and then run :luafile %
local M = {}
function M.select()
vim.ui.select({ "Australia", "Belarus", "Canada", "Denmark", "Egypt", "Fiji" }, {
prompt = "Select a country",
format_item = function(item)
return "I like to visit " .. item
end,
}, function(country, idx)
if country then
print("You selected " .. country .. " at index " .. idx)
else
print("You cancelled")
end
end)
end
M.select()
return M
The idea here is to try and reproduce your issue even without auto-session being involved at all.
Absolutely no problems at all
The ui is there for auto-session too:
Maybe a call to vim.fs.normalize()
is needed somewhere?
Thanks for trying that out, just wanted to rule something out. I have also just realized that the windows path handling might not be working well. I also have no real way of testing this as I'm not a windows user myself, but I'd be happy to help someone with this if they've got the time to dig in. The hypothesis is that the issue is only around the parsing of the path from the real path to the escaped path and back.
I wouldn't mind trying - could you point me in the right direction? Any suggestions as to what should be checked where?
There are a couple of windows specific functions in this file you could start playing with to see what you get https://github.com/rmagatti/auto-session/blob/04ccdac802200ecc363b251cf922b2b022bb515c/lua/auto-session-library.lua#L116
@rmagatti I think this can be closed now