提交 b20c2228 编写于 作者: J Joao Moreno

views: don't lose workspace views states when writing

fixes #80043
上级 6d624ae2
......@@ -522,9 +522,7 @@ export class PersistentContributableViewsModel extends ContributableViewsModel {
}
private saveWorkspaceViewsStates(): void {
const storedViewsStates: { [id: string]: IStoredWorkspaceViewState } = {};
let hasState = false;
const storedViewsStates: { [id: string]: IStoredWorkspaceViewState } = JSON.parse(this.storageService.get(this.workspaceViewsStateStorageId, StorageScope.WORKSPACE, '{}'));
for (const viewDescriptor of this.viewDescriptors) {
const viewState = this.viewStates.get(viewDescriptor.id);
if (viewState) {
......@@ -534,11 +532,10 @@ export class PersistentContributableViewsModel extends ContributableViewsModel {
size: viewState.size,
order: viewDescriptor.workspace && viewState ? viewState.order : undefined
};
hasState = true;
}
}
if (hasState) {
if (Object.keys(storedViewsStates).length > 0) {
this.storageService.store(this.workspaceViewsStateStorageId, JSON.stringify(storedViewsStates), StorageScope.WORKSPACE);
} else {
this.storageService.remove(this.workspaceViewsStateStorageId, StorageScope.WORKSPACE);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册