Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
Wrapper: Separate service configuration and init
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisalmen committed Nov 10, 2023
1 parent 69a3212 commit 8c6d819
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/monaco-editor-wrapper/src/wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ export class MonacoEditorLanguageClientWrapper {
} else {
this.editorApp = new EditorAppExtended(this.id, userConfig, this.logger);
}

// editorApps init their own service thats why they have to be created first
this.configureServices();
await this.initServices();

this.languageClientWrapper.init(this.editorApp.getConfig().languageId,
Expand All @@ -62,10 +64,10 @@ export class MonacoEditorLanguageClientWrapper {
this.initDone = true;
}

private async initServices() {
// always set required services if not configure
protected configureServices() {
// always set required services if not configured
this.serviceConfig.userServices = this.serviceConfig.userServices ?? {};
const configureService = this.serviceConfig.userServices.configure;
const configureService = this.serviceConfig.userServices.configure ?? undefined;

if (!configureService) {
const mlcDefautServices = {
Expand All @@ -77,7 +79,9 @@ export class MonacoEditorLanguageClientWrapper {

// overrule debug log flag
this.serviceConfig.debugLogging = this.logger.isEnabled() && (this.serviceConfig.debugLogging || this.logger.isDebugEnabled());
}

protected async initServices() {
if (wasVscodeApiInitialized()) {
this.logger.debug('No service init on restart', this.serviceConfig.debugLogging);
} else {
Expand Down

0 comments on commit 8c6d819

Please sign in to comment.