@@ -87,20 +87,15 @@ export class ActivitybarPart extends Part {
8787 overflowActionSize : ActivitybarPart . ACTION_HEIGHT
8888 } ) ) ;
8989
90- const previousState = this . storageService . get ( ActivitybarPart . PLACEHOLDER_VIEWLETS , StorageScope . GLOBAL , void 0 ) ;
91- if ( previousState ) {
92- let parsedPreviousState = < IPlaceholderComposite [ ] > JSON . parse ( previousState ) ;
93- parsedPreviousState . forEach ( ( s ) => {
94- if ( typeof s . iconUrl === 'object' ) {
95- s . iconUrl = URI . revive ( s . iconUrl ) ;
96- } else {
97- s . iconUrl = void 0 ;
98- }
99- } ) ;
100- this . placeholderComposites = parsedPreviousState ;
101- } else {
102- this . placeholderComposites = this . compositeBar . getCompositesFromStorage ( ) . map ( id => ( < IPlaceholderComposite > { id, iconUrl : void 0 } ) ) ;
103- }
90+ const previousState = this . storageService . get ( ActivitybarPart . PLACEHOLDER_VIEWLETS , StorageScope . GLOBAL , '[]' ) ;
91+ this . placeholderComposites = < IPlaceholderComposite [ ] > JSON . parse ( previousState ) ;
92+ this . placeholderComposites . forEach ( ( s ) => {
93+ if ( typeof s . iconUrl === 'object' ) {
94+ s . iconUrl = URI . revive ( s . iconUrl ) ;
95+ } else {
96+ s . iconUrl = void 0 ;
97+ }
98+ } ) ;
10499
105100 this . registerListeners ( ) ;
106101 this . updateCompositebar ( ) ;
@@ -119,15 +114,15 @@ export class ActivitybarPart extends Part {
119114 if ( enabled ) {
120115 this . compositeBar . addComposite ( this . viewletService . getViewlet ( id ) ) ;
121116 } else {
122- this . removeComposite ( id ) ;
117+ this . removeComposite ( id , true ) ;
123118 }
124119 } ) ) ;
125120
126121 this . _register ( this . extensionService . onDidRegisterExtensions ( ( ) => this . onDidRegisterExtensions ( ) ) ) ;
127122 }
128123
129124 private onDidRegisterExtensions ( ) : void {
130- this . removeNotExistingPlaceholderComposites ( ) ;
125+ this . removeNotExistingComposites ( ) ;
131126 this . updateCompositebar ( ) ;
132127 }
133128
@@ -283,17 +278,21 @@ export class ActivitybarPart extends Part {
283278 }
284279 }
285280
286- private removeNotExistingPlaceholderComposites ( ) : void {
287- const viewlets = this . viewletService . getViewlets ( ) ;
281+ private removeNotExistingComposites ( ) : void {
282+ const viewlets = this . viewletService . getAllViewlets ( ) ;
288283 for ( const { id } of this . placeholderComposites ) {
289284 if ( viewlets . every ( viewlet => viewlet . id !== id ) ) {
290- this . removeComposite ( id ) ;
285+ this . removeComposite ( id , false ) ;
291286 }
292287 }
293288 }
294289
295- private removeComposite ( compositeId : string ) : void {
296- this . compositeBar . removeComposite ( compositeId ) ;
290+ private removeComposite ( compositeId : string , hide : boolean ) : void {
291+ if ( hide ) {
292+ this . compositeBar . hideComposite ( compositeId ) ;
293+ } else {
294+ this . compositeBar . removeComposite ( compositeId ) ;
295+ }
297296 const compositeActions = this . compositeActions [ compositeId ] ;
298297 if ( compositeActions ) {
299298 compositeActions . activityAction . dispose ( ) ;
@@ -337,7 +336,7 @@ export class ActivitybarPart extends Part {
337336 }
338337
339338 shutdown ( ) : void {
340- const state = this . viewletService . getViewlets ( ) . map ( viewlet => ( { id : viewlet . id , iconUrl : viewlet . iconUrl } ) ) ;
339+ const state = this . viewletService . getAllViewlets ( ) . map ( ( { id , iconUrl } ) => ( { id, iconUrl } ) ) ;
341340 this . storageService . store ( ActivitybarPart . PLACEHOLDER_VIEWLETS , JSON . stringify ( state ) , StorageScope . GLOBAL ) ;
342341
343342 super . shutdown ( ) ;
0 commit comments