### Description Git operations block the UI thread whilst they are running. ### Neovim version ```text NVIM v0.8.3 Build type: Release LuaJIT 2.1.0-beta3 ``` ### Operating system and version Linux 6.1.9-arch1-1 ### nvim-tree version 02fdc26 ### Minimal config ```lua 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 { git = { timeout = 3000, }, } end ``` ### Steps to reproduce Replace git job with "sleep 2" ### Expected behavior _No response_ ### Actual behavior _No response_
Activity
alex-courtis commentedon Feb 6, 2023
Replace git command with a 2 sec sleep
1974.patch.txt
alex-courtis commentedon Feb 6, 2023
refresh_node is synchronous and the main codepath for git excecution, usually following debounce: https://github.com/nvim-tree/nvim-tree.lua/blob/master/lua/nvim-tree/explorer/reload.lua#L145
This could be made asynchronous as per #1870 or some simpler means.
alex-courtis commentedon Feb 7, 2023
Async/await is a possibility however adds complexity and is not yet available in nvim: neovim/neovim#19624
It looks like this one might be the winner: https://github.com/lewis6991/async.nvim It's more straightforward and complete that plenary's.
current control is OK: spawn git process, watcher timer to time out.
Runner.runcan invoke a callback on OK/timeout passing raw output as per current return.load_project_statusis invoked only byExplorer:_loadwhich can load the tree in the callback.reload_project:reloadreload_explorercan render in the callback using theevent_runninglockreload_gitcan do the samereload_and_get_git_projectrefresh_noderefresh_nodes_for_pathis problematic due to the iteration; it will probably be OK to callback individuallyfix(#1970): revert git kill, to be completed via #1974 experiment
fix(#1970): revert git kill, to be completed via #1974 experiment
alex-courtis commentedon Feb 12, 2023
SIGINTtimed out processes.SIGKILLprocess that don't interrupt after a further git.timeoutfix(#1970): disable git integration after 5 timeouts (#1990)
alex-courtis commentedon Feb 12, 2023
Unfortunately callbacks from git runner are getting too deep into callback hell, specifically Explorer:_load
Alternatives:
alex-courtis commentedon Mar 27, 2023
core.inithas too great a fanout to makeExplorer:_loadasync.alex-courtis commentedon Mar 27, 2023
Async watcher git execution for files is working. The same can be done for git watcher executions.
The above two are the only reactive git executions; all others are in response to a user action.
That should be sufficient as the perceived delays following user actions are less noticeable.
feat(#1974): experimental.git.async
feat(#1974): experimental.git.async
feat(#1974): experimental.git.async see #2104 (#2094)
alex-courtis commentedon Apr 3, 2023
experiment running
feat(#1974): enable experimental.git.async by default, see #2104
feat(#1974): enable experimental.git.async by default, see #2104 (#2158)