fix: re-evaluate active editor repository when SCM repositories change#308700
Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: re-evaluate active editor repository when SCM repositories change#308700yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Conversation
The _activeEditorRepositoryObs derived observable only re-evaluated when
the active editor changed. It used scmService.getRepository() which is a
plain method call not tracked by the observable system. This meant that if
a repository was registered after the active editor was already open, the
derived would not re-evaluate and the active repository would remain
undefined.
This fix adds a repositoriesObs observable that tracks repository
additions/removals, and reads it inside the derived so that the active
editor's repository is re-evaluated when repositories change. This ensures
that window title variables like ${activeRepositoryName} and
${activeRepositoryBranchName} are correctly populated.
Fixes microsoft#304129
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @lszomoruMatched files:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
${activeRepositoryName}and${activeRepositoryBranchName}window title variables appearing blank in multi-root workspaces_activeEditorRepositoryObsderived observable only tracked active editor changes but not SCM repository additions/removals. When a repository was registered after the editor was already open, the derived would cacheundefinedand never re-evaluate.repositoriesObsobservable that tracksonDidAddRepository/onDidRemoveRepositoryevents and reads it inside the derived to trigger re-evaluation when repositories change.Fixes #304129
Test plan
window.titleto${rootNameShort} - ${activeRepositoryName}or${rootNameShort} - ${activeRepositoryBranchName}