@@ -1417,29 +1417,18 @@ interface RepositoryVisibilityItem {
14171417
14181418class RepositoryVisibilityActionController {
14191419
1420- private alwaysShowRepositories = false ;
14211420 private items = new Map < ISCMRepository , RepositoryVisibilityItem > ( ) ;
14221421 private repositoryCountContextKey : IContextKey < number > ;
14231422 private repositoryVisibilityCountContextKey : IContextKey < number > ;
1424- private scmProviderContextKey : IContextKey < string | undefined > ;
1425- private scmProviderRootUriContextKey : IContextKey < string | undefined > ;
1426- private scmProviderHasRootUriContextKey : IContextKey < boolean > ;
14271423 private readonly disposables = new DisposableStore ( ) ;
14281424
14291425 constructor (
14301426 @IContextKeyService private contextKeyService : IContextKeyService ,
14311427 @ISCMViewService private readonly scmViewService : ISCMViewService ,
1432- @IConfigurationService configurationService : IConfigurationService ,
14331428 @ISCMService scmService : ISCMService
14341429 ) {
14351430 this . repositoryCountContextKey = ContextKeys . RepositoryCount . bindTo ( contextKeyService ) ;
14361431 this . repositoryVisibilityCountContextKey = ContextKeys . RepositoryVisibilityCount . bindTo ( contextKeyService ) ;
1437- this . scmProviderContextKey = ContextKeys . SCMProvider . bindTo ( contextKeyService ) ;
1438- this . scmProviderRootUriContextKey = ContextKeys . SCMProviderRootUri . bindTo ( contextKeyService ) ;
1439- this . scmProviderHasRootUriContextKey = ContextKeys . SCMProviderHasRootUri . bindTo ( contextKeyService ) ;
1440-
1441- configurationService . onDidChangeConfiguration ( this . onDidChangeConfiguration , this , this . disposables ) ;
1442- this . onDidChangeConfiguration ( ) ;
14431432
14441433 scmViewService . onDidChangeVisibleRepositories ( this . onDidChangeVisibleRepositories , this , this . disposables ) ;
14451434 scmService . onDidAddRepository ( this . onDidAddRepository , this , this . disposables ) ;
@@ -1493,27 +1482,9 @@ class RepositoryVisibilityActionController {
14931482 this . repositoryVisibilityCountContextKey . set ( count ) ;
14941483 }
14951484
1496- private onDidChangeConfiguration ( e ?: IConfigurationChangeEvent ) : void {
1497- if ( ! e || e . affectsConfiguration ( 'scm.alwaysShowRepositories' ) ) {
1498- this . alwaysShowRepositories = this . contextKeyService . getContextKeyValue ( 'scm.alwaysShowRepositories' ) === true ;
1499- this . updateRepositoryContextKeys ( ) ;
1500- }
1501- }
1502-
15031485 private updateRepositoryContextKeys ( ) : void {
15041486 this . repositoryCountContextKey . set ( this . items . size ) ;
15051487 this . repositoryVisibilityCountContextKey . set ( Iterable . reduce ( this . items . keys ( ) , ( r , repository ) => r + ( this . scmViewService . isVisible ( repository ) ? 1 : 0 ) , 0 ) ) ;
1506-
1507- if ( ! this . alwaysShowRepositories && this . items . size === 1 ) {
1508- const provider = Iterable . first ( this . items . keys ( ) ) ! . provider ;
1509- this . scmProviderContextKey . set ( provider . contextValue ) ;
1510- this . scmProviderRootUriContextKey . set ( provider . rootUri ?. toString ( ) ) ;
1511- this . scmProviderHasRootUriContextKey . set ( ! ! provider . rootUri ) ;
1512- } else {
1513- this . scmProviderContextKey . set ( undefined ) ;
1514- this . scmProviderRootUriContextKey . set ( undefined ) ;
1515- this . scmProviderHasRootUriContextKey . set ( false ) ;
1516- }
15171488 }
15181489
15191490 dispose ( ) : void {
@@ -2589,6 +2560,10 @@ export class SCMViewPane extends ViewPane {
25892560 private areAllRepositoriesCollapsedContextKey : IContextKey < boolean > ;
25902561 private isAnyRepositoryCollapsibleContextKey : IContextKey < boolean > ;
25912562
2563+ private scmProviderContextKey : IContextKey < string | undefined > ;
2564+ private scmProviderRootUriContextKey : IContextKey < string | undefined > ;
2565+ private scmProviderHasRootUriContextKey : IContextKey < boolean > ;
2566+
25922567 private readonly disposables = new DisposableStore ( ) ;
25932568
25942569 constructor (
@@ -2623,6 +2598,9 @@ export class SCMViewPane extends ViewPane {
26232598 this . viewSortKeyContextKey . set ( this . viewSortKey ) ;
26242599 this . areAllRepositoriesCollapsedContextKey = ContextKeys . SCMViewAreAllRepositoriesCollapsed . bindTo ( contextKeyService ) ;
26252600 this . isAnyRepositoryCollapsibleContextKey = ContextKeys . SCMViewIsAnyRepositoryCollapsible . bindTo ( contextKeyService ) ;
2601+ this . scmProviderContextKey = ContextKeys . SCMProvider . bindTo ( contextKeyService ) ;
2602+ this . scmProviderRootUriContextKey = ContextKeys . SCMProviderRootUri . bindTo ( contextKeyService ) ;
2603+ this . scmProviderHasRootUriContextKey = ContextKeys . SCMProviderHasRootUri . bindTo ( contextKeyService ) ;
26262604
26272605 this . _onDidLayout = new Emitter < void > ( ) ;
26282606 this . layoutCache = { height : undefined , width : undefined , onDidChange : this . _onDidLayout . event } ;
@@ -3120,6 +3098,7 @@ export class SCMViewPane extends ViewPane {
31203098 this . inputRenderer . getRenderedInputWidget ( focusedInput ) ?. forEach ( widget => widget . focus ( ) ) ;
31213099 }
31223100
3101+ this . updateScmProviderContextKeys ( ) ;
31233102 this . updateRepositoryCollapseAllContextKeys ( ) ;
31243103 } ) ) ;
31253104 }
@@ -3131,6 +3110,19 @@ export class SCMViewPane extends ViewPane {
31313110 this . treeContainer . classList . toggle ( 'hide-arrows' , this . viewMode === ViewMode . Tree && theme . hidesExplorerArrows === true ) ;
31323111 }
31333112
3113+ private updateScmProviderContextKeys ( ) : void {
3114+ if ( ! this . alwaysShowRepositories && this . items . size === 1 ) {
3115+ const provider = Iterable . first ( this . items . keys ( ) ) ! . provider ;
3116+ this . scmProviderContextKey . set ( provider . contextValue ) ;
3117+ this . scmProviderRootUriContextKey . set ( provider . rootUri ?. toString ( ) ) ;
3118+ this . scmProviderHasRootUriContextKey . set ( ! ! provider . rootUri ) ;
3119+ } else {
3120+ this . scmProviderContextKey . set ( undefined ) ;
3121+ this . scmProviderRootUriContextKey . set ( undefined ) ;
3122+ this . scmProviderHasRootUriContextKey . set ( false ) ;
3123+ }
3124+ }
3125+
31343126 private updateRepositoryCollapseAllContextKeys ( ) : void {
31353127 if ( ! this . isBodyVisible ( ) || this . items . size === 1 ) {
31363128 this . isAnyRepositoryCollapsibleContextKey . set ( false ) ;
0 commit comments