Skip to content

Commit

Permalink
fix: initialize editor features after participants have been run
Browse files Browse the repository at this point in the history
  • Loading branch information
CompuIves committed Nov 9, 2023
1 parent 3b81576 commit 946873d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
33 changes: 32 additions & 1 deletion scripts/vscode.patch
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ index 23d547570e9..31dfb4fd8d4 100644

export * from 'vs/editor/editor.api';
diff --git a/src/vs/editor/standalone/browser/standaloneServices.ts b/src/vs/editor/standalone/browser/standaloneServices.ts
index 01f2c6987ac..5d6abf9d561 100644
index 01f2c6987ac..b7e352978d6 100644
--- a/src/vs/editor/standalone/browser/standaloneServices.ts
+++ b/src/vs/editor/standalone/browser/standaloneServices.ts
@@ -517,10 +517,14 @@ export class StandaloneKeybindingService extends AbstractKeybindingService {
Expand All @@ -338,6 +338,37 @@ index 01f2c6987ac..5d6abf9d561 100644
this._cachedResolver = new KeybindingResolver(defaults, overrides, (str) => this._log(str));
}
return this._cachedResolver;
@@ -1155,6 +1159,17 @@ export module StandaloneServices {
}
}

+ onDidInitialize.fire();
+
+ return instantiationService;
+ }
+
+ /**
+ * Should be called only once, after the service collection has been initialized. This is not
+ * part of the init of the services, because we want to trigger all lifecycle functions before
+ * we initialize editor features.
+ */
+ export function instantiateEditorFeatures() {
// Instantiate all editor features
const editorFeatures = getEditorFeatures();
for (const feature of editorFeatures) {
@@ -1163,11 +1178,7 @@ export module StandaloneServices {
} catch (err) {
onUnexpectedError(err);
}
- }
-
- onDidInitialize.fire();
-
- return instantiationService;
+ }
}

/**
diff --git a/src/vs/nls.ts b/src/vs/nls.ts
index db57b98d67b..defd683e0b0 100644
--- a/src/vs/nls.ts
Expand Down
4 changes: 4 additions & 0 deletions src/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ export async function initialize (overrides: IEditorOverrideServices, container?
...overrides
})

// Allow our initialization participants to run first...
await startup(instantiationService)

// Then finally initialize the editor services
StandaloneServices.instantiateEditorFeatures()
}

export async function getService<T> (identifier: ServiceIdentifier<T>): Promise<T> {
Expand Down

0 comments on commit 946873d

Please sign in to comment.