mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 03:54:24 +01:00
Sessions - add new context keys for ahead/behind (#303520)
This commit is contained in:
@@ -91,6 +91,8 @@ const enum ChangesVersionMode {
|
||||
const changesVersionModeContextKey = new RawContextKey<ChangesVersionMode>('sessions.changesVersionMode', ChangesVersionMode.AllChanges);
|
||||
const isMergeBaseBranchProtectedContextKey = new RawContextKey<boolean>('sessions.isMergeBaseBranchProtected', false);
|
||||
const hasOpenPullRequestContextKey = new RawContextKey<boolean>('sessions.hasOpenPullRequest', false);
|
||||
const hasIncomingChangesContextKey = new RawContextKey<boolean>('sessions.hasIncomingChanges', false);
|
||||
const hasOutgoingChangesContextKey = new RawContextKey<boolean>('sessions.hasOutgoingChanges', false);
|
||||
|
||||
// --- List Item
|
||||
|
||||
@@ -646,6 +648,18 @@ export class ChangesViewPane extends ViewPane {
|
||||
return metadata?.pullRequestUrl !== undefined;
|
||||
}));
|
||||
|
||||
this.renderDisposables.add(bindContextKey(hasIncomingChangesContextKey, this.scopedContextKeyService, reader => {
|
||||
const repository = this.viewModel.activeSessionRepositoryObs.read(reader);
|
||||
const repositoryState = repository?.state.read(reader);
|
||||
return (repositoryState?.HEAD?.behind ?? 0) > 0;
|
||||
}));
|
||||
|
||||
this.renderDisposables.add(bindContextKey(hasOutgoingChangesContextKey, this.scopedContextKeyService, reader => {
|
||||
const repository = this.viewModel.activeSessionRepositoryObs.read(reader);
|
||||
const repositoryState = repository?.state.read(reader);
|
||||
return (repositoryState?.HEAD?.ahead ?? 0) > 0;
|
||||
}));
|
||||
|
||||
const scopedServiceCollection = new ServiceCollection([IContextKeyService, this.scopedContextKeyService]);
|
||||
const scopedInstantiationService = this.instantiationService.createChild(scopedServiceCollection);
|
||||
this.renderDisposables.add(scopedInstantiationService);
|
||||
|
||||
Reference in New Issue
Block a user