Skip to content

Commit

Permalink
💄
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Nov 22, 2019
1 parent 109fab8 commit f17ce5f
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/vs/workbench/browser/parts/views/views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,21 +429,21 @@ export class ContributableViewsModel extends Disposable {
}
}

const toRemove: { index: number, viewDescriptor: IViewDescriptor; }[] = [];
const toAdd: { index: number, viewDescriptor: IViewDescriptor, size?: number, collapsed: boolean; }[] = [];

viewDescriptors = viewDescriptors.sort(this.compareViewDescriptors.bind(this));

const toRemove: { index: number, viewDescriptor: IViewDescriptor; }[] = [];
for (let index = 0; index < this._viewDescriptors.length; index++) {
const currentViewDescriptor = this._viewDescriptors[index];
if (this.isViewDescriptorVisible(currentViewDescriptor) && viewDescriptors.every(viewDescriptor => viewDescriptor.id !== currentViewDescriptor.id)) {
const { visibleIndex } = this.find(currentViewDescriptor.id);
toRemove.push({ index: visibleIndex, viewDescriptor: currentViewDescriptor });
const previousViewDescriptor = this._viewDescriptors[index];
if (this.isViewDescriptorVisible(previousViewDescriptor) && viewDescriptors.every(viewDescriptor => viewDescriptor.id !== previousViewDescriptor.id)) {
const { visibleIndex } = this.find(previousViewDescriptor.id);
toRemove.push({ index: visibleIndex, viewDescriptor: previousViewDescriptor });
}
}

const previous = this._viewDescriptors;
this._viewDescriptors = viewDescriptors.slice(0);

const toAdd: { index: number, viewDescriptor: IViewDescriptor, size?: number, collapsed: boolean; }[] = [];
for (let i = 0; i < this._viewDescriptors.length; i++) {
const viewDescriptor = this._viewDescriptors[i];
if (this.isViewDescriptorVisible(viewDescriptor) && previous.every(previousViewDescriptor => previousViewDescriptor.id !== viewDescriptor.id)) {
Expand All @@ -452,7 +452,6 @@ export class ContributableViewsModel extends Disposable {
}
}


if (toRemove.length) {
this._onDidRemove.fire(toRemove);
}
Expand Down

0 comments on commit f17ce5f

Please sign in to comment.