Skip to content

Conversation

alex-courtis
Copy link
Member

@alex-courtis alex-courtis commented Mar 27, 2023

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.

end
require("nvim-tree.explorer.reload").refresh_node(node)
require("nvim-tree.renderer").draw()
require("nvim-tree.explorer.reload").refresh_node(node, function()
Copy link
Member Author

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.

"index", -- staging area
}

local function reload_git_status(project_root, path, project, git_status)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved from reload_project


M.reload_project(project_root)
local git_status = M.get_project(project_root)
M.reload_project(project_root, nil, function()
Copy link
Member Author

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.

@alex-courtis alex-courtis requested a review from gegoune March 28, 2023 02:36
@alex-courtis alex-courtis changed the title asynchronous git operations feat(#1974): experimental.git.async Mar 28, 2023
@alex-courtis
Copy link
Member Author

I'd like to create a sticky issue for experiments that we can link in the commit message.

Draft incoming...

git = {
async = false,
},
},
Copy link
Member Author

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.

@alex-courtis
Copy link
Member Author

Added issue: #2104

Dogfooded for a week; it can be reverted easily if any functionality breaks.

@alex-courtis alex-courtis merged commit 0ef3d46 into master Apr 3, 2023
@alex-courtis alex-courtis deleted the 1974-git-threads branch April 3, 2023 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Git Execution Blocks UI Thread

1 participant