monaco-languageclient 10.0.0-next.0 → 10.0.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /* --------------------------------------------------------------------------------------------
2
- * Copyright (c) 2024 TypeFox and others.
2
+ * Copyright (c) 2025 TypeFox and others.
3
3
  * Licensed under the MIT License. See LICENSE in the package root for license information.
4
4
  * ------------------------------------------------------------------------------------------ */
5
5
 
@@ -10,11 +10,11 @@ import getConfigurationServiceOverride, { initUserConfiguration } from '@codinga
10
10
  import getLanguagesServiceOverride from '@codingame/monaco-vscode-languages-service-override';
11
11
  import getLogServiceOverride from '@codingame/monaco-vscode-log-service-override';
12
12
  import getModelServiceOverride from '@codingame/monaco-vscode-model-service-override';
13
- import { ConsoleLogger, verifyUrlOrCreateDataUrl, type Logger } from 'monaco-languageclient/common';
13
+ import { ConsoleLogger, encodeStringOrUrlToDataUrl, type Logger } from 'monaco-languageclient/common';
14
14
  import { useWorkerFactory } from 'monaco-languageclient/workerFactory';
15
15
  import * as vscode from 'vscode';
16
16
  import 'vscode/localExtensionHost';
17
- import type { MonacoVscodeApiConfig } from './config.js';
17
+ import type { ExtensionConfig, MonacoVscodeApiConfig } from './config.js';
18
18
  import { configureExtHostWorker, getEnhancedMonacoEnvironment, mergeServices, reportServiceLoading, useOpenEditorStub } from './utils.js';
19
19
 
20
20
  export interface InitServicesInstructions {
@@ -128,13 +128,13 @@ export class MonacoVscodeApiWrapper {
128
128
  }
129
129
 
130
130
  /**
131
- * set the log-level via the development settings
131
+ * Set the log-level via the development settings.
132
+ * VSCode developmentOptions are read-only. There are no functions exposed to set options directly.
133
+ * Therefore the Object properties need to be manipulated directly via Object.assign.
132
134
  */
133
135
  protected configureDevLogLevel() {
134
136
  const devLogLevel = this.apiConfig.workspaceConfig?.developmentOptions?.logLevel;
135
137
  if (devLogLevel === undefined) {
136
-
137
- // this needs to be done so complicated, because developmentOptions is read-only
138
138
  const devOptions: Record<string, unknown> = {
139
139
  ...this.apiConfig.workspaceConfig!.developmentOptions
140
140
  };
@@ -242,21 +242,29 @@ export class MonacoVscodeApiWrapper {
242
242
  });
243
243
  for (const extensionConfig of extensions ?? []) {
244
244
  if (!extensionIds.includes(`${extensionConfig.config.publisher}.${extensionConfig.config.name}`)) {
245
- const manifest = extensionConfig.config as IExtensionManifest;
246
- const extRegResult = registerExtension(manifest, ExtensionHostKind.LocalProcess);
247
- this.extensionRegisterResults.set(manifest.name, extRegResult);
248
- if (extensionConfig.filesOrContents && Object.hasOwn(extRegResult, 'registerFileUrl')) {
249
- for (const entry of extensionConfig.filesOrContents) {
250
- this.disposableStore.add(extRegResult.registerFileUrl(entry[0], verifyUrlOrCreateDataUrl(entry[1])));
251
- }
252
- }
253
- allPromises.push(extRegResult.whenReady());
245
+ allPromises.push(this.initExtension(extensionConfig, extensionIds));
254
246
  }
255
247
  }
256
248
  await Promise.all(allPromises);
257
249
  }
258
250
  }
259
251
 
252
+ protected initExtension(extensionConfig: ExtensionConfig, extensionIds: string[]): Promise<void> {
253
+ if (!extensionIds.includes(`${extensionConfig.config.publisher}.${extensionConfig.config.name}`)) {
254
+ const manifest = extensionConfig.config as IExtensionManifest;
255
+ const extRegResult = registerExtension(manifest, ExtensionHostKind.LocalProcess);
256
+ this.extensionRegisterResults.set(manifest.name, extRegResult);
257
+ if (extensionConfig.filesOrContents && Object.hasOwn(extRegResult, 'registerFileUrl')) {
258
+ for (const entry of extensionConfig.filesOrContents) {
259
+ this.disposableStore.add(extRegResult.registerFileUrl(entry[0], encodeStringOrUrlToDataUrl(entry[1])));
260
+ }
261
+ }
262
+ return extRegResult.whenReady();
263
+ } else {
264
+ return Promise.resolve();
265
+ }
266
+ }
267
+
260
268
  protected markGlobalInit() {
261
269
  this.logger.debug('markGlobalInit');
262
270
 
@@ -304,7 +312,7 @@ export class MonacoVscodeApiWrapper {
304
312
  // ensure one of the three potential view services are configured
305
313
  await this.configureViewsServices();
306
314
 
307
- // enforece semantic highlighting if configured
315
+ // enforce semantic highlighting if configured
308
316
  this.configureSemanticHighlighting();
309
317
 
310
318
  await this.initUserConfiguration();
@@ -1,5 +1,5 @@
1
1
  /* --------------------------------------------------------------------------------------------
2
- * Copyright (c) 2024 TypeFox and others.
2
+ * Copyright (c) 2025 TypeFox and others.
3
3
  * Licensed under the MIT License. See LICENSE in the package root for license information.
4
4
  * ------------------------------------------------------------------------------------------ */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /* --------------------------------------------------------------------------------------------
2
- * Copyright (c) 2024 TypeFox and others.
2
+ * Copyright (c) 2025 TypeFox and others.
3
3
  * Licensed under the MIT License. See LICENSE in the package root for license information.
4
4
  * ------------------------------------------------------------------------------------------ */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /* --------------------------------------------------------------------------------------------
2
- * Copyright (c) 2024 TypeFox and others.
2
+ * Copyright (c) 2025 TypeFox and others.
3
3
  * Licensed under the MIT License. See LICENSE in the package root for license information.
4
4
  * ------------------------------------------------------------------------------------------ */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /* --------------------------------------------------------------------------------------------
2
- * Copyright (c) 2024 TypeFox and others.
2
+ * Copyright (c) 2025 TypeFox and others.
3
3
  * Licensed under the MIT License. See LICENSE in the package root for license information.
4
4
  * ------------------------------------------------------------------------------------------ */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /* --------------------------------------------------------------------------------------------
2
- * Copyright (c) 2024 TypeFox and others.
2
+ * Copyright (c) 2025 TypeFox and others.
3
3
  * Licensed under the MIT License. See LICENSE in the package root for license information.
4
4
  * ------------------------------------------------------------------------------------------ */
5
5
 
@@ -232,7 +232,7 @@ export class LanguageClientWrapper {
232
232
  } finally {
233
233
  retry++;
234
234
  if (retry > (restartOptions.retries) && !this.isStarted()) {
235
- this.logger?.info('Disabling Language Client. Failed to start clangd after 5 retries');
235
+ this.logger?.info(`Disabling Language Client. Failed to start clangd after ${restartOptions.retries} retries`);
236
236
  } else {
237
237
  setTimeout(async () => {
238
238
  await this.restart(this.worker, restartOptions.keepWorker);