nvim-telescope / telescope-file-browser.nvim

File Browser extension for telescope.nvim
MIT License
1.6k stars 89 forks source link

File browsing too slow in large git repository #359

Open gmmyung opened 4 months ago

gmmyung commented 4 months ago

Description

I am working on a directory with huge git submodules, many gigabytes worth of code. It takes 3 seconds to run git status. It also takes 3 seconds to load the directory, and this delay disappears when git_status = false. Can it be fixed by lazy loading of git status? Fast file browsing is important, but I don't want to completely disable git integration.

Neovim version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1703358377

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.5/share/nvim"

Run :checkhealth for more info

Operating system and version

macOS 14.3.1

Steps to reproduce

:Telescope file_browser

Expected behavior

File browser opens instantly.

Actual behavior

There is significant delay on opening the file browser.

Minimal config

// lazy.nvim config

return {
  'nvim-telescope/telescope.nvim',
  branch = '0.1.x',
  dependencies = {
    'nvim-lua/plenary.nvim',
    'nvim-treesitter/nvim-treesitter',
    'nvim-telescope/telescope-file-browser.nvim',
    'nvim-tree/nvim-web-devicons',
  },
  config = function()
    require('telescope').setup {
      extensions = {
    file_browser = {
      hijack_netrw = true,
    }
      }
    }
    require('telescope').load_extension 'file_browser'
  end,
  keys = {
    { '<Leader>d', '<cmd>Telescope file_browser<cr>', mode = 'n', desc = 'Telescope file browser' },
    { '<Leader>b', '<cmd>Telescope buffers<cr>', mode = 'n', desc = 'Telescope buffers' },
    { '<Leader>ff', '<cmd>Telescope find_files<cr>', mode = 'n', desc = 'Telescope find file'},
  }
}
jamestrew commented 4 months ago

This is an interesting idea. Unfortunately, I don't think telescope has a mechanism for doing such a thing at the moment. But I'll keep this in mind for future telescope enhancements and keep this issue open. There might be some workaround for it in the meantime I can explore.

ema2159 commented 1 month ago

I experience the same. I work in quite a large codebase in my company, and although telescope-file-browser is not yet unusable, it is quite slow. Using something like nvim-tree doesn't give the same issue.