fix(command): normalize reveal_file path argument #1402
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I found that when using neo-tree with project.nvim, when changing cwd via project selector,
reveal
argument doesn't work, the file is not focused upon opening the tree. Turns out, project.nvim normalizes disk names on Windows to lower casehttps://github.com/ahmedkhalf/project.nvim/blob/8c6bad7d22eef1b71144b401c9f74ed01526a4fb/lua/project_nvim/utils/history.lua#L32-L34
As a result, switching directories via project.nvim on Windows results in all file paths having lower case drive letter
Meanwhile, neo-tree normalizes drive names to upper case
neo-tree.nvim/lua/neo-tree/utils/init.lua
Lines 792 to 793 in 120a83e
But it doesn't do so for
reveal_file
argument. Since normalized file names are used as case sensitive ids, neo-tree is unable to find file to reveal and just does nothing.The issue can be trivially reproduced by running
:cd c:\[directory]
with drive letter in lower case and trying to open neo-tree withreveal
argument (or relative path inreveal_file
argument).This fix applies same normalization process to the input parameter, eliminating possible discrepancies.