Skip to content

Do not access/update the storage state directly #96939

Closed
@sandy081

Description

@sandy081

Storage state is changed directly by the layout service while applying the default layout. Eg:

storageService.store(`${viewletId}.state.hidden`, JSON.stringify(viewsState), StorageScope.GLOBAL);
storageService.store(`${viewletId}.state`, JSON.stringify(viewsWorkspaceState), StorageScope.WORKSPACE);
}
}
if (sidebarState.length) {
storageService.store(ActivitybarPart.PINNED_VIEWLETS, JSON.stringify(sidebarState), StorageScope.GLOBAL);

I do not think this is the right way to access/update the state that is internal to a specific component/service. This will break if the corresponding component/service changes its semantics. Worst that corresponding component/service owner will not be aware that something is broken. It seems keys are also hardcoded 😞

Right way to do this is to add APIs to corresponding services and let the services change their state.

I would strongly recommend to change this at the earliest.

@bpasero @sbatten FYI

Metadata

Metadata

Assignees

Labels

debtCode quality issuesimportantIssue identified as high-priorityinsiders-releasedPatch has been released in VS Code Insiders

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions