提交 48a237ce 编写于 作者: S SteVen Batten

fixes #89579

上级 2ea221bd
...@@ -445,7 +445,7 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor ...@@ -445,7 +445,7 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
} }
} }
private moveViews(views: IViewDescriptor[], from: ViewContainer, to: ViewContainer): void { private moveViews(views: IViewDescriptor[], from: ViewContainer, to: ViewContainer, skipCacheUpdate?: boolean): void {
this.removeViews(from, views); this.removeViews(from, views);
this.addViews(to, views); this.addViews(to, views);
...@@ -457,7 +457,10 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor ...@@ -457,7 +457,10 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
} }
this._onDidChangeContainer.fire({ views, from, to }); this._onDidChangeContainer.fire({ views, from, to });
this.saveViewPositionsToCache();
if (!skipCacheUpdate) {
this.saveViewPositionsToCache();
}
} }
private registerViewContainerForSingleView(sourceView: IViewDescriptor, location: ViewContainerLocation): ViewContainer { private registerViewContainerForSingleView(sourceView: IViewDescriptor, location: ViewContainerLocation): ViewContainer {
...@@ -493,15 +496,28 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor ...@@ -493,15 +496,28 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
const newCachedPositions = this.getCachedViewPositions(); const newCachedPositions = this.getCachedViewPositions();
for (let viewId of newCachedPositions.keys()) { for (let viewId of newCachedPositions.keys()) {
const viewDescriptor = this.getViewDescriptor(viewId);
if (!viewDescriptor) {
continue;
}
const prevViewContainer = this.getViewContainer(viewId); const prevViewContainer = this.getViewContainer(viewId);
const newViewContainer = this.viewContainersRegistry.get(newCachedPositions.get(viewId)!.containerId); const newViewContainerInfo = newCachedPositions.get(viewId)!;
// Verify if we need to create the destination container
if (newViewContainerInfo.sourceViewId) {
const sourceViewDescriptor = this.getViewDescriptor(newViewContainerInfo.sourceViewId);
if (!this.viewContainersRegistry.get(newViewContainerInfo.containerId) && sourceViewDescriptor) {
this.registerViewContainerForSingleView(sourceViewDescriptor, newViewContainerInfo.location!);
}
}
// Try moving to the new container
const newViewContainer = this.viewContainersRegistry.get(newViewContainerInfo.containerId);
if (prevViewContainer && newViewContainer && newViewContainer !== prevViewContainer) { if (prevViewContainer && newViewContainer && newViewContainer !== prevViewContainer) {
const viewDescriptor = this.getViewDescriptor(viewId); const viewDescriptor = this.getViewDescriptor(viewId);
if (viewDescriptor) { if (viewDescriptor) {
// We don't call move views to avoid sending intermediate this.moveViews([viewDescriptor], prevViewContainer, newViewContainer);
// cached data to the window that gave us this information
this.removeViews(prevViewContainer, [viewDescriptor]);
this.addViews(newViewContainer, [viewDescriptor]);
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册