Skip to content

Commit 90eb129

Browse files
committed
refactor: name server storage lifecycle constants
1 parent ce5016a commit 90eb129

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎patches/remote-storage.diff‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,23 @@ Reuse VS Code's Electron storage service for remote persistence
55
@@ -14 +14 @@
66
-import { ILifecycleMainService, LifecycleMainPhase, ShutdownReason } from '../../lifecycle/electron-main/lifecycleMainService.js';
77
+import type { ILifecycleMainService, ShutdownReason } from '../../lifecycle/electron-main/lifecycleMainService.js';
8+
+
9+
+// Keep these values local so the server does not load lifecycleMainService at runtime;
10+
+// that module imports Electron, which is not present in the code-server server image.
11+
+const LIFECYCLE_MAIN_PHASE_AFTER_WINDOW_OPEN = 3;
12+
+const SHUTDOWN_REASON_KILL = 2;
813
@@ -101 +101 @@
914
- @ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService,
1015
+ private readonly lifecycleMainService: ILifecycleMainService,
1116
@@ -117 +117 @@
1217
- await this.lifecycleMainService.when(LifecycleMainPhase.AfterWindowOpen);
13-
+ await this.lifecycleMainService.when(3 /* LifecycleMainPhase.AfterWindowOpen */);
18+
+ await this.lifecycleMainService.when(LIFECYCLE_MAIN_PHASE_AFTER_WINDOW_OPEN);
1419
@@ -256 +256 @@
1520
- if (this.shutdownReason === ShutdownReason.KILL) {
16-
+ if (this.shutdownReason === 2 /* ShutdownReason.KILL */) {
21+
+ if (this.shutdownReason === SHUTDOWN_REASON_KILL) {
1722
@@ -295 +295 @@
1823
- if (this.shutdownReason === ShutdownReason.KILL) {
19-
+ if (this.shutdownReason === 2 /* ShutdownReason.KILL */) {
24+
+ if (this.shutdownReason === SHUTDOWN_REASON_KILL) {
2025

2126
--- code-server.orig/lib/vscode/src/vs/workbench/services/storage/electron-browser/storageService.ts
2227
+++ code-server/lib/vscode/src/vs/workbench/services/storage/electron-browser/storageService.ts

0 commit comments

Comments
 (0)