Open shaun-mathew opened 2 years ago
I don't really use sshfs myself. Can you check which component is causing the issue ?
Sure, I'll take a look. Do you have a lua profiler that you use for debugging? I'm getting errors trying to run plenary.profile (https://github.com/nvim-lua/plenary.nvim#plenaryprofile)
Seems like disabling both the filetype component and the branch component stops the lag
It's probably just the branch component. When a new file is opened it tries to find git root for that file . This can cause plenty of io operations to climb up the directory tree and to check for .git folder . I think that's just slow for sshfs as the io operations relays on servers reply. Not sure what to do about this though without finding git root we can't show the git branch .
Yeah, that's what I figured. It appears that the directory I'm in doesn't have a .git directory, so it appears that the branch component periodically performs this recursive check for a .git directory to see if one does exist and because of server latency the UI slows down. I did add a cache entry to the git_dir_cache entry table when the git_dir is nil which "fixes" the issue. Unfortunately, this would have the added side-effect of not properly updating lualine if a git init is called after neovim is open. Is it possible to update the branch component less frequently, since it would then be possible to clear the cache entry in the case that the git_dir is nil?
With regard to the filetype component, adding nvim-web-devicons as a requirement and using require instead of pcall require in the apply_icon() function fixes that issue. For some reason, a protected call makes it lag when the nvim-web-devicons plugin is not installed.
We can eventually make the fs calls async so it doesn't block ui. For now if you have other git plugins like gitsigns, vim-fugitive ... you can show the branch status from those plugins instead of the branch component. For example like this
If pcall is removed lualine will throw an error if nvim-webdevicons isn't installed . If you don't want icons in filetype component you can set icons_enabled option in filetype component to false that should fix the delay I believe.
lualine_x = {
{'filetype', icons_enabled = false}
}
Self Checks
How to reproduce the problem
Expected behaviour
Neovim does not lag when opening files in remote-mounted directory.
Actual behaviour
Extreme degradation of performance when navigating through newly opened files in remote-mounted directory
Minimal config to reproduce the issue
Aditional information
Tried with another statusline plugin (feline.nvim) and the issue doesn't appear when using said statusline plugin.