- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 637
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Git operations block the UI thread whilst they are running.
Neovim version
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
Minimal config
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
vuki656
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Milestone
Relationships
Development
Select code repository
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.run
can invoke a callback on OK/timeout passing raw output as per current return.load_project_status
is invoked only byExplorer:_load
which can load the tree in the callback.reload_project
:reload
reload_explorer
can render in the callback using theevent_running
lockreload_git
can do the samereload_and_get_git_project
refresh_node
refresh_nodes_for_path
is 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
SIGINT
timed out processes.SIGKILL
process 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:
Shift+R
removesgit
icons #1966alex-courtis commentedon Mar 27, 2023
core.init
has too great a fanout to makeExplorer:_load
async.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)