Skip to content

[BUG] When attempting to load via Autosession search, it cannot find directory #195

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

Closed
Gremious opened this issue Dec 24, 2022 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@Gremious
Copy link

Gremious commented Dec 24, 2022

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:

image

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:

  1. Uninstall session-lens and disable the telescope plugin.
  2. (Perhaps uninstall dressing as well, however, it repros for me with it too)
  3. Restart vim
  4. Go to a valid directory, open a few buffers, save a session
  5. Run Autosession search and pick the new one
  6. 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.

@Gremious Gremious added the bug Something isn't working label Dec 24, 2022
@rmagatti
Copy link
Owner

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

@Gremious
Copy link
Author

If I can provide and logs or further info, please do say 👍

@Mupu
Copy link

Mupu commented Jan 16, 2023

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?

@rmagatti
Copy link
Owner

rmagatti commented Jan 31, 2023

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.

@Gremious
Copy link
Author

Gremious commented Feb 8, 2023

image
image

Absolutely no problems at all

The ui is there for auto-session too:

image

Maybe a call to vim.fs.normalize() is needed somewhere?

@rmagatti
Copy link
Owner

rmagatti commented Feb 8, 2023

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.

@Gremious
Copy link
Author

I wouldn't mind trying - could you point me in the right direction? Any suggestions as to what should be checked where?

@rmagatti
Copy link
Owner

There are a couple of windows specific functions in this file you could start playing with to see what you get

return IS_WIN32 and win32_unescaped_dir(dir) or dir:gsub("%%", "/")

@cameronr
Copy link
Collaborator

cameronr commented Aug 2, 2024

@rmagatti I think this can be closed now

@rmagatti rmagatti closed this as completed Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants