Fix: SCM More Actions menu auto-closes with Git autofetch and Copilot #233662
+23
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: SCM More Actions Menu Auto-closes with Git Autofetch and Copilot
I noticed that the Source Control "More Actions" menu was closing unexpectedly when Git autofetch and GitHub Copilot were enabled. This PR addresses that behavior (#233650).
The Issue
The menu would automatically close when Git autofetch was set to 1 second and GitHub Copilot was installed. This made it difficult to use the More Actions menu effectively.
Fixes Applied
I've improved how we handle menu focus in the SCMRepository class to make it more stable during Git autofetch operations. Here's what I did:
Added menu focus tracking with debouncing
_menuFocused
state to track menu focusEnsured proper cleanup when disposing
Created events to handle focus changes
_onDidChangeMenuFocus
emitteronDidChangeMenuFocus
event for UI layersetMenuFocus
method to manage focus state changesTesting
You can test this by:
git.autofetchPeriod
to 1git.autofetch
Related Issue
Fixes #233650