@@ -1787,7 +1787,7 @@ class SCMInputWidgetActionRunner extends ActionRunner {
1787
1787
1788
1788
constructor (
1789
1789
private readonly input : ISCMInput ,
1790
- @IContextKeyService private readonly contextKeyService : IContextKeyService ,
1790
+ @IContextKeyService contextKeyService : IContextKeyService ,
1791
1791
@IStorageService private readonly storageService : IStorageService
1792
1792
) {
1793
1793
super ( ) ;
@@ -1797,11 +1797,6 @@ class SCMInputWidgetActionRunner extends ActionRunner {
1797
1797
1798
1798
protected override async runAction ( action : IAction ) : Promise < void > {
1799
1799
try {
1800
- // Check if toolbar is disabled
1801
- if ( this . contextKeyService . getContextKeyValue ( SCMInputContextKeys . ActionIsEnabled . key ) === false ) {
1802
- return ;
1803
- }
1804
-
1805
1800
// Cancel previous action
1806
1801
if ( this . _ctxIsActionRunning . get ( ) === true ) {
1807
1802
this . _cts ?. cancel ( ) ;
@@ -1899,7 +1894,7 @@ class SCMInputWidgetToolbar extends WorkbenchToolBar {
1899
1894
this . _store . add ( menu . onDidChange ( ( ) => updateToolbar ( ) ) ) ;
1900
1895
1901
1896
const ctxKeys = new Set < string > ( [ SCMInputContextKeys . ActionIsEnabled . key , SCMInputContextKeys . ActionIsRunning . key ] ) ;
1902
- Event . filter ( contextKeyService . onDidChangeContext , e => e . affectsSome ( ctxKeys ) ) ( ( ) => updateToolbar ( ) ) ;
1897
+ this . _store . add ( Event . filter ( contextKeyService . onDidChangeContext , e => e . affectsSome ( ctxKeys ) ) ( ( ) => updateToolbar ( ) ) ) ;
1903
1898
1904
1899
// Delay initial update to finish class initialization
1905
1900
setTimeout ( ( ) => updateToolbar ( ) , 0 ) ;
@@ -2127,6 +2122,7 @@ class SCMInputWidget {
2127
2122
2128
2123
const ctxIsActionEnabled = SCMInputContextKeys . ActionIsEnabled . bindTo ( this . toolbarContextKeyService ) ;
2129
2124
this . repositoryDisposables . add ( input . repository . provider . onDidChangeResources ( ( ) => ctxIsActionEnabled . set ( input . repository . provider . groups . some ( r => r . resources . length > 0 ) ) ) ) ;
2125
+ ctxIsActionEnabled . set ( input . repository . provider . groups . some ( r => r . resources . length > 0 ) ) ;
2130
2126
2131
2127
const actionRunner = instantiationService2 . createInstance ( SCMInputWidgetActionRunner , input ) ;
2132
2128
this . repositoryDisposables . add ( actionRunner ) ;
0 commit comments