nvim-tree / nvim-tree.lua

A file explorer tree for neovim written in lua
Other
6.99k stars 605 forks source link

Wrong filepath opened when selecting file #2862

Open LandonHarter opened 1 month ago

LandonHarter commented 1 month ago

Description

I am unable to open a file and read it because nvim-tree, when selecting a file, will open a nonexistent file. The route it should be opening should be \app\(pages)\(app)\document\[id]\page.tsx but instead opens \app(pages)(app)\document\[id]\page.tsx. I don't seem to have this issue with other plugins such as telescope, where I can use the file finder and it will give me a preview of the content (I will provide an image below). My guess is when it tries to put a backslash before a parenthesis, it registers it as just a parenthesis (kind of how in regex you have to put a backslash before some characters).

Incorrect Path

image

Telescope Displaying Content Correctly

image

Neovim version

NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1713484068

Operating system and version

Windows 11

Windows variant

No response

nvim-tree version

v1.5.0 (latest)

Clean room replication

I am a bit confused about this step, but you can find my neovim setup here:
https://github.com/LandonHarter/neovim/master

Steps to reproduce

  1. Create a directory that starts and ends with parenthesis (maybe try nesting a few together like mine in the photo)
  2. Create a file in one of the new directories
  3. Try to open the file with nvim-tree

Expected behavior

Opens the file

Actual behavior

Tries to open a nonexistent file leading to me being unable to edit the file

alex-courtis commented 1 month ago

When opening on windows, special characters will be escaped: https://github.com/nvim-tree/nvim-tree.lua/blob/8704b6f7fc0bdbc4e0a754fa1e1d3fd3c9bf4969/lua/nvim-tree/utils.lua#L263

It looks like there's some handling of parenthesis in there.

No nvim-tree team members have access to or experience with windows.

I'm going to ask you to attempt a fix as we have no way to test or verify it.

As a sanity check first: please enumerate your feature flags to ensure that windows is being correctly detected.