Skip to content

Use state service for process explorer state #169363

@bpasero

Description

@bpasero

This is a follow up from #169090

I would suggest to not use the storage service for process explorer state but IStateMainService. That is the same service we also use to store window state for workbench windows.

Using storage service from the main process requires you to await the whenReady event because unlike state service, the storage service is not ready when you use it:

/**
* Important: unlike other storage services in the renderer, the
* main process does not await the storage to be ready, rather
* storage is being initialized while a window opens to reduce
* pressure on startup.
*
* As such, any client wanting to access application storage from the
* main process needs to wait for `whenReady`, otherwise there is
* a chance that the service operates on an in-memory store that
* is not backed by any persistent DB.
*/
readonly whenReady: Promise<void>;

State service is always available and can be used as a drop-in replacement.

Here is where its used for windows and the key we use is windowsState, so maybe it should be processExplorerWindowState.

this.stateMainService.setItem(WindowsStateHandler.windowsStateStorageKey, state);

Metadata

Metadata

Assignees

Labels

debtCode quality issuesinsiders-releasedPatch has been released in VS Code Insidersworkbench-diagnosticsGeneral VS Code built-in diagnostic issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions