Code change:
this.repositoryDisposables.clear(); } } <ins> export class SCMActiveResourceContextKeyController implements IWorkbenchContribution { private contextKey: IContextKey<boolean>; private disposables = new DisposableStore(); private repositoryDisposables = new Set<IDisposable>(); constructor( @IContextKeyService readonly contextKeyService: IContextKeyService, @IEditorService private readonly editorService: IEditorService, @ISCMService private readonly scmService: ISCMService, @IUriIdentityService private readonly uriIdentityService: IUriIdentityService ) { this.contextKey = contextKeyService.createKey('scmActiveResourceHasChanges', false); this.scmService.onDidAddRepository(this.onDidAddRepository, this, this.disposables); for (const repository of this.scmService.repositories) { this.onDidAddRepository(repository); } editorService.onDidActiveEditorChange(this.updateContextKey, this, this.disposables); } private onDidAddRepository(repository: ISCMRepository): void { const onDidChange = Event.any(repository.provider.onDidChange, repository.provider.onDidChangeResources); const changeDisposable = onDidChange(() => this.updateContextKey()); const onDidRemove = Event.filter(this.scmService.onDidRemoveRepository, e => e === repository); const removeDisposable = onDidRemove(() => { disposable.dispose(); this.repositoryDisposables.delete(disposable); this.updateContextKey(); }); const disposable = combinedDisposable(changeDisposable, removeDisposable); this.repositoryDisposables.add(disposable); } private updateContextKey(): void { const activeResource = EditorResourceAccessor.getOriginalUri(this.editorService.activeEditor); if (activeResource && activeResource.scheme === Schemas.file) { for (const repository of this.scmService.repositories) { for (const resourceGroup of repository.provider.groups.elements) { if (resourceGroup.elements.find(scmResource => { return this.uriIdentityService.extUri.isEqual(activeResource, scmResource.sourceUri); })) { this.contextKey.set(true); return; } } } } this.contextKey.set(false); } dispose(): void { this.disposables = dispose(this.disposables); dispose(this.repositoryDisposables.values()); this.repositoryDisposables.clear(); } } </ins>

Related discussion:
text: <!-- Do you have a question? Please ask it on --VSCode Version: 1.12.1 OS Version: OS X EI Capitan 10.11.3 Steps to Reproduce: some project from GitHub. a file A.cs which has no fresh changes at all. on the editor of A.cs, and notice the button of on the top right corner above the editor doesn't display as disbled! Clicking it has no effect of course, but it should display as disable in this case just like what in the old versions.
Can't fix without , closing for now.
since it connot be fixed without , should this be kept open and linked to then?
Sure.
To keep the number of issues in our inbox on a manageable level, we're closing issues that have been on the backlog for a long time but haven't gained traction: We look at the number of votes the issue has received and the number of duplicates issues filed. Thanks for your understanding. Happy coding!
Hoping to re-open this because I got this as a feedback item from a few CS educators. They notice their students clicking it accidentally and being confused when there is no apparent action.
I think this has regressed, I now miss this button when a file is staged.
Fixed regression with
There is another regression (), so I will be reverting this fix for this, and will refactor it.