Winpathfix
The misguided assumption that the path separator on Windows would always be a backslash, and therefore that checking if the path separator was a backslash was equivalent to checking if the OS was Windows, there were issues with path normalization when using forward slash as the path separator on Windows (with the 'shellslash' option set).
My tweaks involve checking for the existence of the 'shellslash' option to determine whether or not to use Windows-style paths, and (if it does exist) checking its value to determine which path separator to expect. I also added the invocation of the vim.fs.normalize function at the end of the Plenary path normalization function to hopefully catch any edge cases, although in hindsight it's probably best to only invoke it when there are still both forward and backward slashes in the path at that point.
This is an interesting one. I'm tracking a ton of Windows path issues in Telescope and I was about to take a look into this issue.
Couple of thoughts from me:
- I'm not sure what the state of unit tests for
path_spec.luais for Windows - have you run the tests with your changes? (ideally, we'd support both unix and windows testing in CI, I've done this for telescope so I can do the same for plenary) - I think using
vim.fs.normalizeis out, plenary doesn't declare a hard minimal neovim version but certainly for telescope, we support down to neovim 0.7 and I don't believe any of thevim.fsfunctions exists or if they do,vim.fs.normalizehad some pretty significant changes recently.