|
5 | 5 |
|
6 | 6 | import { workspace, WorkspaceFoldersChangeEvent, Uri, window, Event, EventEmitter, QuickPickItem, Disposable, SourceControl, SourceControlResourceGroup, TextEditor, Memento, commands } from 'vscode';
|
7 | 7 | import TelemetryReporter from '@vscode/extension-telemetry';
|
8 |
| -import { Repository, RepositoryState } from './repository'; |
| 8 | +import { Operation, Repository, RepositoryState } from './repository'; |
9 | 9 | import { memoize, sequentialize, debounce } from './decorators';
|
10 | 10 | import { dispose, anyEvent, filterEvent, isDescendant, pathEquals, toDisposable, eventToPromise } from './util';
|
11 | 11 | import { Git } from './git';
|
@@ -467,11 +467,28 @@ export class Model implements IRemoteSourcePublisherRegistry, IPostCommitCommand
|
467 | 467 | });
|
468 | 468 | checkForSubmodules();
|
469 | 469 |
|
| 470 | + const updateCommitInProgressContext = () => { |
| 471 | + let commitInProgress = false; |
| 472 | + for (const { repository } of this.openRepositories.values()) { |
| 473 | + if (repository.operations.isRunning(Operation.Commit)) { |
| 474 | + commitInProgress = true; |
| 475 | + break; |
| 476 | + } |
| 477 | + } |
| 478 | + |
| 479 | + commands.executeCommand('setContext', 'commitInProgress', commitInProgress); |
| 480 | + }; |
| 481 | + |
| 482 | + const operationEvent = anyEvent(repository.onDidRunOperation as Event<any>, repository.onRunOperation as Event<any>); |
| 483 | + const operationListener = operationEvent(() => updateCommitInProgressContext()); |
| 484 | + updateCommitInProgressContext(); |
| 485 | + |
470 | 486 | const dispose = () => {
|
471 | 487 | disappearListener.dispose();
|
472 | 488 | changeListener.dispose();
|
473 | 489 | originalResourceChangeListener.dispose();
|
474 | 490 | statusListener.dispose();
|
| 491 | + operationListener.dispose(); |
475 | 492 | repository.dispose();
|
476 | 493 |
|
477 | 494 | this.openRepositories = this.openRepositories.filter(e => e !== openRepository);
|
|
0 commit comments