nvim-telescope / telescope-file-browser.nvim

File Browser extension for telescope.nvim
MIT License
1.68k stars 92 forks source link

Folders with [] throw an error #307

Open abdullahahmeda opened 1 year ago

abdullahahmeda commented 1 year ago

Description

I have the following structure:

[centerId]\
index.tsx

When I access [centerId]\ An error is thrown: image

Neovim version

NVIM v0.10.0-dev-915+g898ef1835
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Operating system and version

Windows 11

Steps to reproduce

  1. Create a folder named [centerId] for example
  2. Navigate to it by pressing Enter (or <CR>)
  3. An error should be thrown

Expected behavior

Folder should open normally

Actual behavior

An error is thrown. You can see an image of the error above

Minimal config

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
  require('packer').startup {
    {
      'wbthomason/packer.nvim',
      {
        'nvim-telescope/telescope.nvim',
        requires = {
          'nvim-lua/plenary.nvim',
          'nvim-telescope/telescope-file-browser.nvim',
        },
      },
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
      display = { non_interactive = true },
    },
  }
end
_G.load_config = function()
  require('telescope').setup()
  require('telescope').load_extension('file_browser')
  -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
end
if vim.fn.isdirectory(install_path) == 0 then
  print("Installing Telescope and dependencies.")
  vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]
jamestrew commented 1 year ago

hmm... I can't replicate this on linux. can you try using :set shellslash?

abdullahahmeda commented 1 year ago

:set shellslash didn't help

I will check plenary. It seems like this error is related to it

abdullahahmeda commented 1 year ago

This is very interesting. I just stopped all the plugins I use and commented all the lines in my init.lua (I'm using nvim btw). And netrw just hides everything inside [centerId] (and I'm not alone).

So I think this issue is more related to nvim now. I would appreciate any help. But thank you anyways

jamestrew commented 1 year ago

Yeah this type of issue is a known issue on Windows.

https://github.com/nvim-telescope/telescope.nvim/issues/2651 https://github.com/neovim/neovim/issues/24542 -- neovim core - but there is no "fix" for (). https://github.com/nvim-telescope/telescope.nvim/issues/2446#issuecomment-1706737878

The last linked comment is precisely the same issue you're experiencing I believe. It seems to be related to a powershell behavior.

We can probably escape the brackets on the telescope/plenary side of this but it's a fairly sensitive topic (os specific path manipulation) especially when no one maintaining telescope/plenary is on windows.

I'm sorry but probably the quickest way to fix this for yourself might be to move to WSL :grimacing:

abdullahahmeda commented 1 year ago

I think I'll move to linux again. Thank you for your support!

jamestrew commented 6 months ago

This might (at least be partially) improved by https://github.com/nvim-telescope/telescope.nvim/pull/2628

abdullahahmeda commented 6 months ago

I have switched to linux long time ago. Thank you anyway!