-
-
Notifications
You must be signed in to change notification settings - Fork 625
feat(#1974): experimental.git.async #2094
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
Conversation
…uired for sync codepaths that loop
@@ -59,8 +59,9 @@ function M.create_watcher(node) | |||
else | |||
log.line("watcher", "node event executing refresh '%s'", node.absolute_path) | |||
end | |||
require("nvim-tree.explorer.reload").refresh_node(node) | |||
require("nvim-tree.renderer").draw() | |||
require("nvim-tree.explorer.reload").refresh_node(node, function() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the last action, hence safe to use a callback.
@@ -22,6 +22,21 @@ local WATCHED_FILES = { | |||
"index", -- staging area | |||
} | |||
|
|||
local function reload_git_status(project_root, path, project, git_status) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved from reload_project
@@ -103,21 +122,22 @@ local function reload_tree_at(project_root) | |||
return | |||
end | |||
|
|||
M.reload_project(project_root) | |||
local git_status = M.get_project(project_root) | |||
M.reload_project(project_root, nil, function() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Safe to call back as this is the last operation of the watcher.
I'd like to create a sticky issue for experiments that we can link in the commit message. Draft incoming... |
git = { | ||
async = false, | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like gitsigns has stopped (underscore prefixed) experiments.
Using the same pattern as the various lsp plugins.
Added issue: #2104 Dogfooded for a week; it can be reverted easily if any functionality breaks. |
fixes #1974
File system and .git watchers execute asynchronously.
All other operations execute synchronously. It is impractical to (ever?) make them asynchronous due to their looping nature.
Completely separate codepaths was impractical, hence some refactoring to use callbacks was done. Async/await is coming to nvim API which will allow simplification to always use callbacks for synchronous operations.
@gegoune a sanity check would be gratefully appreciated before releasing this.