natecraddock / workspaces.nvim

a simple plugin to manage workspace directories in neovim
MIT License
309 stars 15 forks source link

Failure to open a workspace from another workspace #5

Closed sibouras closed 2 years ago

sibouras commented 2 years ago
workspaces.setup({
  hooks = {
    -- hooks run before change directory
    open_pre = {
      "SessionsStop",
      "silent %bdelete!",
    },

    -- load any saved session from current directory
    open = function()
      require("sessions").load(nil, { silent = true })
    end,
  },
})

this config used to work before this commit b26f8720a4053af46a36d1e1ff110a647d66046f and when i updated this plugin it doesn't, i think it has something to do with the path because when i do WorkspacesOpen something the working directory doesn't change and it loads the same session.

natecraddock commented 2 years ago

Hm, that commit definitely could have broken something on Windows. I don't have time at this moment to take a closer look, but I can look closer in a few hours. In the meantime, could you share a bit more information to help me debug?

Navigate manually to the workspace's directory. Then run :lua print(vim.fn.fnamemodify(vim.fn.getcwd(), ":p")). Does the output end in a separator? \ or /?

Looking closer at the code I think I know the issue, and this will help me make sure :)

sibouras commented 2 years ago

thanks for the amazing plugin :) the output ends in \ here's a small recording of what happens

https://user-images.githubusercontent.com/64098483/153516817-e6d5a552-3970-41eb-a84f-3993769a2eeb.mp4

natecraddock commented 2 years ago

I think I figured it out! I replicated the bug on Linux, it's just an edge case from what I can see, not Windows-specific. Could you try the fix-5-find branch and see if that fixes the issue for you?

sibouras commented 2 years ago

yess its fixed now, thanks alot 🤗

natecraddock commented 2 years ago

Great to hear it! You're welcome! I have one other tiny thing to fix, then I'll update master soon after.