@@ -1417,29 +1417,18 @@ interface RepositoryVisibilityItem {
1417
1417
1418
1418
class RepositoryVisibilityActionController {
1419
1419
1420
- private alwaysShowRepositories = false ;
1421
1420
private items = new Map < ISCMRepository , RepositoryVisibilityItem > ( ) ;
1422
1421
private repositoryCountContextKey : IContextKey < number > ;
1423
1422
private repositoryVisibilityCountContextKey : IContextKey < number > ;
1424
- private scmProviderContextKey : IContextKey < string | undefined > ;
1425
- private scmProviderRootUriContextKey : IContextKey < string | undefined > ;
1426
- private scmProviderHasRootUriContextKey : IContextKey < boolean > ;
1427
1423
private readonly disposables = new DisposableStore ( ) ;
1428
1424
1429
1425
constructor (
1430
1426
@IContextKeyService private contextKeyService : IContextKeyService ,
1431
1427
@ISCMViewService private readonly scmViewService : ISCMViewService ,
1432
- @IConfigurationService configurationService : IConfigurationService ,
1433
1428
@ISCMService scmService : ISCMService
1434
1429
) {
1435
1430
this . repositoryCountContextKey = ContextKeys . RepositoryCount . bindTo ( contextKeyService ) ;
1436
1431
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 ( ) ;
1443
1432
1444
1433
scmViewService . onDidChangeVisibleRepositories ( this . onDidChangeVisibleRepositories , this , this . disposables ) ;
1445
1434
scmService . onDidAddRepository ( this . onDidAddRepository , this , this . disposables ) ;
@@ -1493,27 +1482,9 @@ class RepositoryVisibilityActionController {
1493
1482
this . repositoryVisibilityCountContextKey . set ( count ) ;
1494
1483
}
1495
1484
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
-
1503
1485
private updateRepositoryContextKeys ( ) : void {
1504
1486
this . repositoryCountContextKey . set ( this . items . size ) ;
1505
1487
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
- }
1517
1488
}
1518
1489
1519
1490
dispose ( ) : void {
@@ -2589,6 +2560,10 @@ export class SCMViewPane extends ViewPane {
2589
2560
private areAllRepositoriesCollapsedContextKey : IContextKey < boolean > ;
2590
2561
private isAnyRepositoryCollapsibleContextKey : IContextKey < boolean > ;
2591
2562
2563
+ private scmProviderContextKey : IContextKey < string | undefined > ;
2564
+ private scmProviderRootUriContextKey : IContextKey < string | undefined > ;
2565
+ private scmProviderHasRootUriContextKey : IContextKey < boolean > ;
2566
+
2592
2567
private readonly disposables = new DisposableStore ( ) ;
2593
2568
2594
2569
constructor (
@@ -2623,6 +2598,9 @@ export class SCMViewPane extends ViewPane {
2623
2598
this . viewSortKeyContextKey . set ( this . viewSortKey ) ;
2624
2599
this . areAllRepositoriesCollapsedContextKey = ContextKeys . SCMViewAreAllRepositoriesCollapsed . bindTo ( contextKeyService ) ;
2625
2600
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 ) ;
2626
2604
2627
2605
this . _onDidLayout = new Emitter < void > ( ) ;
2628
2606
this . layoutCache = { height : undefined , width : undefined , onDidChange : this . _onDidLayout . event } ;
@@ -3120,6 +3098,7 @@ export class SCMViewPane extends ViewPane {
3120
3098
this . inputRenderer . getRenderedInputWidget ( focusedInput ) ?. forEach ( widget => widget . focus ( ) ) ;
3121
3099
}
3122
3100
3101
+ this . updateScmProviderContextKeys ( ) ;
3123
3102
this . updateRepositoryCollapseAllContextKeys ( ) ;
3124
3103
} ) ) ;
3125
3104
}
@@ -3131,6 +3110,19 @@ export class SCMViewPane extends ViewPane {
3131
3110
this . treeContainer . classList . toggle ( 'hide-arrows' , this . viewMode === ViewMode . Tree && theme . hidesExplorerArrows === true ) ;
3132
3111
}
3133
3112
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
+
3134
3126
private updateRepositoryCollapseAllContextKeys ( ) : void {
3135
3127
if ( ! this . isBodyVisible ( ) || this . items . size === 1 ) {
3136
3128
this . isAnyRepositoryCollapsibleContextKey . set ( false ) ;
0 commit comments