auto-session icon indicating copy to clipboard operation
auto-session copied to clipboard

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

Open Gremious opened this issue 2 years ago • 8 comments

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 avatar Dec 24 '22 17:12 Gremious

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

rmagatti avatar Dec 26 '22 10:12 rmagatti

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

Gremious avatar Dec 26 '22 14:12 Gremious

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?

Mupu avatar Jan 16 '23 22:01 Mupu

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.

rmagatti avatar Jan 31 '23 08:01 rmagatti

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?

Gremious avatar Feb 08 '23 12:02 Gremious

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.

rmagatti avatar Feb 08 '23 19:02 rmagatti

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

Gremious avatar Feb 14 '23 12:02 Gremious

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 avatar Feb 17 '23 05:02 rmagatti

@rmagatti I think this can be closed now

cameronr avatar Aug 02 '24 17:08 cameronr