Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quitting neovim takes a long time when toggling git ignore folders #2723

Open
itsramiel opened this issue Mar 23, 2024 · 3 comments
Open

Quitting neovim takes a long time when toggling git ignore folders #2723

itsramiel opened this issue Mar 23, 2024 · 3 comments
Labels
awaiting feedback performance performance enhancement

Comments

@itsramiel
Copy link
Contributor

Description

When I toggle a git ignore folders and javascript's node_modules is visible it takes an unusual longer time to quit neovim. I dont mean it only happens with node_modules but tht is my use case. Check the video where I have only nvim-tree as a dependency and I quit neovim when git ignore folders are hidden vs when they are visible.

Screen.Recording.2024-03-23.at.8.47.03.PM.mov

One weird thing is that if I delete the .gitignore file and the node_modules is visible from the start then it quits just as fast as usual. It is only when I toggle the git ignore files from hidden to visible

Screen.Recording.2024-03-23.at.9.50.38.PM.mov

I dont really have any idea why, but let me know if I can help in any way

Neovim version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1703358377

Operating system and version

Macos 14.3.1

Windows variant

No response

nvim-tree version

commit: 707b24a

Clean room replication

I tested it without any other plugin

vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvt-min/site]]
local package_root = "/tmp/nvt-min/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
  require("packer").startup {
    {
      "wbthomason/packer.nvim",
      "nvim-tree/nvim-tree.lua",
      "nvim-tree/nvim-web-devicons",
      -- 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
if vim.fn.isdirectory(install_path) == 0 then
  print "Installing nvim-tree 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 setup()]]
vim.opt.termguicolors = true
vim.opt.cursorline = true

-- MODIFY NVIM-TREE SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
_G.setup = function()
  require("nvim-tree").setup {}
end

-- UNCOMMENT this block for diagnostics issues, substituting pattern and cmd as appropriate.
-- Requires diagnostics.enable = true in setup.
--[[
vim.api.nvim_create_autocmd("FileType", {
  pattern = "lua",
  callback = function()
    vim.lsp.start { cmd = { "lua-language-server" } }
  end,
})
]]


### Steps to reproduce

1. create a directory and cd into it
2. run `npm init -y` to initialize an empty js project
3. run `npm install {add many packages to have a large node_modules}`
4. add a .gitignore with `node_modules`
5. try quitting neovim after toggling gitignore files vs not and see the quitting difference

### Expected behavior

I expect neovim to quit just as fast even when ignored git files are shown

### Actual behavior

Neovim quits slow when hidden git files are shown
@itsramiel itsramiel added the bug Something isn't working label Mar 23, 2024
@alex-courtis
Copy link
Member

Attempted replication with this 900MB setup:

git clone [email protected]:facebook/create-react-app.git
cd create-react-app
yarn

I and E on node_modules. No performance issue at any step. However, I am running on linux with btrfs.

This macos user had a similar issue, the root cause being the filesystem watchers. Resolution: #2438 (comment)

  filesystem_watchers = {
    ignore_dirs = {
      "node_modules"
    },
  },

Which filesystem are you using? Is it case sensitive? Are you using full disk encryption?

@alex-courtis alex-courtis added awaiting feedback performance performance enhancement and removed bug Something isn't working labels Mar 24, 2024
@itsramiel
Copy link
Contributor Author

This macos user had a similar issue, the root cause being the filesystem watchers. Resolution: #2438 (comment)

  filesystem_watchers = {
    ignore_dirs = {
      "node_modules"
    },
  },

This solved it for me

Which filesystem are you using? Is it case sensitive? Are you using full disk encryption?

I dont really know the answer to these questions. I am happy to find out if you can let me know how.

Feel free to close the issue or keep it open if you want to dig deeper and I can help if you need me to check something

@alex-courtis
Copy link
Member

I dont really know the answer to these questions. I am happy to find out if you can let me know how.

Just encryption would be great.

Feel free to close the issue or keep it open if you want to dig deeper and I can help if you need me to check something

It would be great if you could collect a log, indicating the time you quit.

log = {
  enable = true,
  truncate = true,
  types = {
    all = false,
    config = false,
    copy_paste = false,
    dev = false,
    diagnostics = false,
    git = false,
    profile = true,
    watcher = true,
  },
},

I'm not certain there's much we can do about this; node modules is problematic for many tools and is ignored by default: #3649

It might be time to add that, given the number of issues this has caused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback performance performance enhancement
Projects
None yet
Development

No branches or pull requests

2 participants