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); |
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
whenReadyevent because unlike state service, the storage service is not ready when you use it:vscode/src/vs/platform/storage/electron-main/storageMainService.ts
Lines 298 to 309 in 461b3f6
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 beprocessExplorerWindowState.vscode/src/vs/platform/windows/electron-main/windowsStateHandler.ts
Line 217 in 461b3f6