monaco-languageclient 7.3.0 → 8.0.0-next.2

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.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,13 @@
2
2
 
3
3
  All notable changes to this npm module are documented in this file.
4
4
 
5
- ## [7.3.0] - 2024-01-03
5
+ ## [8.0.0] - 2024-03-0x
6
+
7
+ - WIP: Repository now includes `monaco-editor-wrapper` and `@typefox/monaco-editor-react`
8
+ - Updated to `@codingame/monaco-vscode-api@2.0.1`. This ensures amoung other things proper sematic versioning
9
+ - Details
10
+
11
+ ## [7.3.0] - 2024-01-04
6
12
 
7
13
  - Updated to `@codingame/monaco-vscode-api@1.85.0` and `@codingame/monaco-editor-treemende@1.85.0` / `monaco-editor@0.45.0`
8
14
 
package/License.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io)
1
+ Copyright (c) 2018-2024 TypeFox GmbH (http://www.typefox.io)
2
2
 
3
3
  All rights reserved.
4
4
 
package/lib/index.d.ts CHANGED
@@ -1,5 +1,24 @@
1
- export type { IConnectionProvider, MonacoLanguageClientOptions } from './monaco-language-client.js';
2
- export * from './monaco-language-client.js';
3
- export type { InitializeServiceConfig, MonacoEnvironmentEnhanced } from './monaco-vscode-api-services.js';
4
- export * from './monaco-vscode-api-services.js';
1
+ import { BaseLanguageClient, MessageTransports, LanguageClientOptions } from 'vscode-languageclient/lib/common/client.js';
2
+ export interface IConnectionProvider {
3
+ get(encoding: string): Promise<MessageTransports>;
4
+ }
5
+ export type MonacoLanguageClientOptions = {
6
+ name: string;
7
+ id?: string;
8
+ clientOptions: LanguageClientOptions;
9
+ connectionProvider: IConnectionProvider;
10
+ };
11
+ export declare class MonacoLanguageClient extends BaseLanguageClient {
12
+ protected readonly connectionProvider: IConnectionProvider;
13
+ constructor({ id, name, clientOptions, connectionProvider }: MonacoLanguageClientOptions);
14
+ protected createMessageTransports(encoding: string): Promise<MessageTransports>;
15
+ }
16
+ /**
17
+ * monaco-languageclient requires the following services in addition to the default services monaco-vscode-api provides:
18
+ * - languages
19
+ * - model
20
+ */
21
+ export declare const supplyRequiredServices: () => {
22
+ [x: string]: any;
23
+ };
5
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AACpG,cAAc,6BAA6B,CAAC;AAC5C,YAAY,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC1G,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAE1H,MAAM,WAAW,mBAAmB;IAChC,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACrD;AAED,MAAM,MAAM,2BAA2B,GAAG;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,qBAAqB,CAAC;IACrC,kBAAkB,EAAE,mBAAmB,CAAC;CAC3C,CAAA;AAED,qBAAa,oBAAqB,SAAQ,kBAAkB;IACxD,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,mBAAmB,CAAC;gBAE/C,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,kBAAkB,EAAE,EAAE,2BAA2B;cAKrE,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAG3F;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;CAKlC,CAAC"}
package/lib/index.js CHANGED
@@ -1,7 +1,29 @@
1
1
  /* --------------------------------------------------------------------------------------------
2
- * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.
2
+ * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved.
3
3
  * Licensed under the MIT License. See License.txt in the project root for license information.
4
4
  * ------------------------------------------------------------------------------------------ */
5
- export * from './monaco-language-client.js';
6
- export * from './monaco-vscode-api-services.js';
5
+ import getLanguagesServiceOverride from '@codingame/monaco-vscode-languages-service-override';
6
+ import getModelServiceOverride from '@codingame/monaco-vscode-model-service-override';
7
+ import { BaseLanguageClient } from 'vscode-languageclient/lib/common/client.js';
8
+ export class MonacoLanguageClient extends BaseLanguageClient {
9
+ connectionProvider;
10
+ constructor({ id, name, clientOptions, connectionProvider }) {
11
+ super(id || name.toLowerCase(), name, clientOptions);
12
+ this.connectionProvider = connectionProvider;
13
+ }
14
+ createMessageTransports(encoding) {
15
+ return this.connectionProvider.get(encoding);
16
+ }
17
+ }
18
+ /**
19
+ * monaco-languageclient requires the following services in addition to the default services monaco-vscode-api provides:
20
+ * - languages
21
+ * - model
22
+ */
23
+ export const supplyRequiredServices = () => {
24
+ return {
25
+ ...getLanguagesServiceOverride(),
26
+ ...getModelServiceOverride()
27
+ };
28
+ };
7
29
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,cAAc,6BAA6B,CAAC;AAE5C,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,2BAA2B,MAAM,qDAAqD,CAAC;AAC9F,OAAO,uBAAuB,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAA4C,MAAM,4CAA4C,CAAC;AAa1H,MAAM,OAAO,oBAAqB,SAAQ,kBAAkB;IACrC,kBAAkB,CAAsB;IAE3D,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,kBAAkB,EAA+B;QACpF,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;QACrD,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IACjD,CAAC;IAEkB,uBAAuB,CAAC,QAAgB;QACvD,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;CACJ;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,EAAE;IACvC,OAAO;QACH,GAAG,2BAA2B,EAAE;QAChC,GAAG,uBAAuB,EAAE;KAC/B,CAAC;AACN,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monaco-languageclient",
3
- "version": "7.3.0",
3
+ "version": "8.0.0-next.2",
4
4
  "description": "Monaco Language client implementation",
5
5
  "author": {
6
6
  "name": "TypeFox GmbH",
@@ -37,8 +37,8 @@
37
37
  "npm": ">=9.0.0"
38
38
  },
39
39
  "volta": {
40
- "node": "20.10.0",
41
- "npm": "10.2.3"
40
+ "node": "20.11.1",
41
+ "npm": "10.2.4"
42
42
  },
43
43
  "files": [
44
44
  "lib",
@@ -48,33 +48,26 @@
48
48
  "License.txt"
49
49
  ],
50
50
  "dependencies": {
51
- "@codingame/monaco-vscode-editor-service-override": "~1.85.0",
52
- "@codingame/monaco-vscode-languages-service-override": "~1.85.0",
53
- "@codingame/monaco-vscode-model-service-override": "~1.85.0",
54
- "monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.85.0 <1.86.0",
55
- "vscode": "npm:@codingame/monaco-vscode-api@>=1.85.0 <1.86.0",
51
+ "@codingame/monaco-vscode-languages-service-override": "~3.0.0",
52
+ "@codingame/monaco-vscode-model-service-override": "~3.0.0",
56
53
  "vscode-languageclient": "~9.0.1"
57
54
  },
58
55
  "peerDependencies": {
59
- "monaco-editor": "0.45.0",
60
- "vscode": "npm:@codingame/monaco-vscode-api@>=1.85.0 <1.86.0"
56
+ "@codingame/monaco-vscode-api": "~3.0.0",
57
+ "@codingame/monaco-vscode-editor-api": "~3.0.0",
58
+ "vscode": "npm:@codingame/monaco-vscode-api@~3.0.0"
61
59
  },
62
60
  "peerDependenciesMeta": {
63
- "monaco-editor": {
61
+ "@codingame/monaco-vscode-api": {
62
+ "optional": false
63
+ },
64
+ "@codingame/monaco-vscode-editor-api": {
64
65
  "optional": false
65
66
  },
66
67
  "vscode": {
67
68
  "optional": false
68
69
  }
69
70
  },
70
- "overrides": {
71
- "monaco-editor": "$monaco-editor",
72
- "vscode": "$vscode"
73
- },
74
- "resolutions": {
75
- "monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.85.0 <1.86.0",
76
- "vscode": "npm:@codingame/monaco-vscode-api@>=1.85.0 <1.86.0"
77
- },
78
71
  "scripts": {
79
72
  "clean": "shx rm -fr lib *.tsbuildinfo",
80
73
  "compile": "tsc --build tsconfig.src.json",
package/src/index.ts CHANGED
@@ -1,9 +1,44 @@
1
1
  /* --------------------------------------------------------------------------------------------
2
- * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.
2
+ * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved.
3
3
  * Licensed under the MIT License. See License.txt in the project root for license information.
4
4
  * ------------------------------------------------------------------------------------------ */
5
5
 
6
- export type { IConnectionProvider, MonacoLanguageClientOptions } from './monaco-language-client.js';
7
- export * from './monaco-language-client.js';
8
- export type { InitializeServiceConfig, MonacoEnvironmentEnhanced } from './monaco-vscode-api-services.js';
9
- export * from './monaco-vscode-api-services.js';
6
+ import getLanguagesServiceOverride from '@codingame/monaco-vscode-languages-service-override';
7
+ import getModelServiceOverride from '@codingame/monaco-vscode-model-service-override';
8
+ import { BaseLanguageClient, MessageTransports, LanguageClientOptions } from 'vscode-languageclient/lib/common/client.js';
9
+
10
+ export interface IConnectionProvider {
11
+ get(encoding: string): Promise<MessageTransports>;
12
+ }
13
+
14
+ export type MonacoLanguageClientOptions = {
15
+ name: string;
16
+ id?: string;
17
+ clientOptions: LanguageClientOptions;
18
+ connectionProvider: IConnectionProvider;
19
+ }
20
+
21
+ export class MonacoLanguageClient extends BaseLanguageClient {
22
+ protected readonly connectionProvider: IConnectionProvider;
23
+
24
+ constructor({ id, name, clientOptions, connectionProvider }: MonacoLanguageClientOptions) {
25
+ super(id || name.toLowerCase(), name, clientOptions);
26
+ this.connectionProvider = connectionProvider;
27
+ }
28
+
29
+ protected override createMessageTransports(encoding: string): Promise<MessageTransports> {
30
+ return this.connectionProvider.get(encoding);
31
+ }
32
+ }
33
+
34
+ /**
35
+ * monaco-languageclient requires the following services in addition to the default services monaco-vscode-api provides:
36
+ * - languages
37
+ * - model
38
+ */
39
+ export const supplyRequiredServices = () => {
40
+ return {
41
+ ...getLanguagesServiceOverride(),
42
+ ...getModelServiceOverride()
43
+ };
44
+ };
@@ -1,16 +0,0 @@
1
- import { BaseLanguageClient, MessageTransports, LanguageClientOptions } from 'vscode-languageclient/lib/common/client.js';
2
- export interface IConnectionProvider {
3
- get(encoding: string): Promise<MessageTransports>;
4
- }
5
- export type MonacoLanguageClientOptions = {
6
- name: string;
7
- id?: string;
8
- clientOptions: LanguageClientOptions;
9
- connectionProvider: IConnectionProvider;
10
- };
11
- export declare class MonacoLanguageClient extends BaseLanguageClient {
12
- protected readonly connectionProvider: IConnectionProvider;
13
- constructor({ id, name, clientOptions, connectionProvider }: MonacoLanguageClientOptions);
14
- protected createMessageTransports(encoding: string): Promise<MessageTransports>;
15
- }
16
- //# sourceMappingURL=monaco-language-client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"monaco-language-client.d.ts","sourceRoot":"","sources":["../src/monaco-language-client.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAE1H,MAAM,WAAW,mBAAmB;IAChC,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACrD;AAED,MAAM,MAAM,2BAA2B,GAAG;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,qBAAqB,CAAC;IACrC,kBAAkB,EAAE,mBAAmB,CAAC;CAC3C,CAAA;AAED,qBAAa,oBAAqB,SAAQ,kBAAkB;IACxD,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,mBAAmB,CAAC;gBAE/C,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,kBAAkB,EAAE,EAAE,2BAA2B;cAKrE,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAG3F"}
@@ -1,16 +0,0 @@
1
- /* --------------------------------------------------------------------------------------------
2
- * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- * ------------------------------------------------------------------------------------------ */
5
- import { BaseLanguageClient } from 'vscode-languageclient/lib/common/client.js';
6
- export class MonacoLanguageClient extends BaseLanguageClient {
7
- connectionProvider;
8
- constructor({ id, name, clientOptions, connectionProvider }) {
9
- super(id || name.toLowerCase(), name, clientOptions);
10
- this.connectionProvider = connectionProvider;
11
- }
12
- createMessageTransports(encoding) {
13
- return this.connectionProvider.get(encoding);
14
- }
15
- }
16
- //# sourceMappingURL=monaco-language-client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"monaco-language-client.js","sourceRoot":"","sources":["../src/monaco-language-client.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,kBAAkB,EAA4C,MAAM,4CAA4C,CAAC;AAa1H,MAAM,OAAO,oBAAqB,SAAQ,kBAAkB;IACrC,kBAAkB,CAAsB;IAE3D,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,kBAAkB,EAA+B;QACpF,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;QACrD,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IACjD,CAAC;IAEkB,uBAAuB,CAAC,QAAgB;QACvD,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;CACJ"}
@@ -1,31 +0,0 @@
1
- import { editor, Environment } from 'monaco-editor';
2
- import { IWorkbenchConstructionOptions } from 'vscode/services';
3
- import 'vscode/localExtensionHost';
4
- import { OpenEditor } from '@codingame/monaco-vscode-editor-service-override';
5
- export interface MonacoEnvironmentEnhanced extends Environment {
6
- vscodeApiInitialised: boolean;
7
- }
8
- export type InitializeServiceConfig = {
9
- userServices?: editor.IEditorOverrideServices;
10
- debugLogging?: boolean;
11
- workspaceConfig?: IWorkbenchConstructionOptions;
12
- };
13
- export declare const wasVscodeApiInitialized: () => boolean;
14
- export declare const initServices: (config?: InitializeServiceConfig) => Promise<void>;
15
- export declare const useOpenEditorStub: OpenEditor;
16
- export declare const reportServiceLoading: (services: editor.IEditorOverrideServices, debugLogging: boolean) => void;
17
- export declare const mergeServices: (services: editor.IEditorOverrideServices, overrideServices: editor.IEditorOverrideServices) => void;
18
- /**
19
- * monaco-vscode-api automatically loads the following services:
20
- * - layout
21
- * - environment
22
- * - extension
23
- * - files
24
- * - quickAccess
25
- *
26
- * monaco-languageclient always adds the following services:
27
- * - languages
28
- * - model
29
- */
30
- export declare const importAllServices: (config?: InitializeServiceConfig) => Promise<void>;
31
- //# sourceMappingURL=monaco-vscode-api-services.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"monaco-vscode-api-services.d.ts","sourceRoot":"","sources":["../src/monaco-vscode-api-services.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAA2B,6BAA6B,EAAsB,MAAM,iBAAiB,CAAC;AAC7G,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,kDAAkD,CAAC;AAI9E,MAAM,WAAW,yBAA0B,SAAQ,WAAW;IAC1D,oBAAoB,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,MAAM,uBAAuB,GAAG;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC,uBAAuB,CAAC;IAC9C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,6BAA6B,CAAC;CACnD,CAAC;AAEF,eAAO,MAAM,uBAAuB,eAEnC,CAAC;AAEF,eAAO,MAAM,YAAY,YAAmB,uBAAuB,kBAelE,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,UAG/B,CAAC;AAEF,eAAO,MAAM,oBAAoB,aAAc,OAAO,uBAAuB,gBAAgB,OAAO,SAMnG,CAAC;AAEF,eAAO,MAAM,aAAa,aAAc,OAAO,uBAAuB,oBAAoB,OAAO,uBAAuB,SAIvH,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,YAAmB,uBAAuB,kBA+BvE,CAAC"}
@@ -1,84 +0,0 @@
1
- /* --------------------------------------------------------------------------------------------
2
- * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- * ------------------------------------------------------------------------------------------ */
5
- import { ILogService, initialize, StandaloneServices } from 'vscode/services';
6
- import 'vscode/localExtensionHost';
7
- import getLanguagesServiceOverride from '@codingame/monaco-vscode-languages-service-override';
8
- import getModelServiceOverride from '@codingame/monaco-vscode-model-service-override';
9
- export const wasVscodeApiInitialized = () => {
10
- return window.MonacoEnvironment?.vscodeApiInitialised === true;
11
- };
12
- export const initServices = async (config) => {
13
- if (!wasVscodeApiInitialized()) {
14
- await importAllServices(config);
15
- if (config?.debugLogging === true) {
16
- console.log('Initialization of vscode services completed successfully.');
17
- }
18
- if (!window.MonacoEnvironment) {
19
- window.MonacoEnvironment = {};
20
- }
21
- window.MonacoEnvironment.vscodeApiInitialised = true;
22
- }
23
- else {
24
- if (config?.debugLogging === true) {
25
- console.log('Initialization of vscode services can only performed once!');
26
- }
27
- }
28
- };
29
- export const useOpenEditorStub = async (modelRef, options, sideBySide) => {
30
- console.log('Received open editor call with parameters: ', modelRef, options, sideBySide);
31
- return undefined;
32
- };
33
- export const reportServiceLoading = (services, debugLogging) => {
34
- for (const serviceName of Object.keys(services)) {
35
- if (debugLogging) {
36
- console.log(`Loading service: ${serviceName}`);
37
- }
38
- }
39
- };
40
- export const mergeServices = (services, overrideServices) => {
41
- for (const [name, service] of Object.entries(services)) {
42
- overrideServices[name] = service;
43
- }
44
- };
45
- /**
46
- * monaco-vscode-api automatically loads the following services:
47
- * - layout
48
- * - environment
49
- * - extension
50
- * - files
51
- * - quickAccess
52
- *
53
- * monaco-languageclient always adds the following services:
54
- * - languages
55
- * - model
56
- */
57
- export const importAllServices = async (config) => {
58
- const lc = config ?? {};
59
- const userServices = lc.userServices ?? {};
60
- const mlcDefautServices = {
61
- ...getLanguagesServiceOverride(),
62
- ...getModelServiceOverride()
63
- };
64
- mergeServices(mlcDefautServices, userServices);
65
- reportServiceLoading(userServices, lc.debugLogging === true);
66
- const haveThemeService = Object.keys(userServices).includes('themeService');
67
- const haveTextmateService = Object.keys(userServices).includes('textMateTokenizationFeature');
68
- const haveMarkersService = Object.keys(userServices).includes('markersService');
69
- const haveViewsService = Object.keys(userServices).includes('viewsService');
70
- // theme requires textmate
71
- if (haveThemeService && !haveTextmateService) {
72
- throw new Error('"theme" service requires "textmate" service. Please add it to the "userServices".');
73
- }
74
- // markers service requires views service
75
- if (haveMarkersService && !haveViewsService) {
76
- throw new Error('"markers" service requires "views" service. Please add it to the "userServices".');
77
- }
78
- await initialize(userServices);
79
- const logLevel = lc.workspaceConfig?.developmentOptions?.logLevel;
80
- if (logLevel) {
81
- StandaloneServices.get(ILogService).setLevel(logLevel);
82
- }
83
- };
84
- //# sourceMappingURL=monaco-vscode-api-services.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"monaco-vscode-api-services.js","sourceRoot":"","sources":["../src/monaco-vscode-api-services.ts"],"names":[],"mappings":"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"}
@@ -1,30 +0,0 @@
1
- /* --------------------------------------------------------------------------------------------
2
- * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- * ------------------------------------------------------------------------------------------ */
5
-
6
- import { BaseLanguageClient, MessageTransports, LanguageClientOptions } from 'vscode-languageclient/lib/common/client.js';
7
-
8
- export interface IConnectionProvider {
9
- get(encoding: string): Promise<MessageTransports>;
10
- }
11
-
12
- export type MonacoLanguageClientOptions = {
13
- name: string;
14
- id?: string;
15
- clientOptions: LanguageClientOptions;
16
- connectionProvider: IConnectionProvider;
17
- }
18
-
19
- export class MonacoLanguageClient extends BaseLanguageClient {
20
- protected readonly connectionProvider: IConnectionProvider;
21
-
22
- constructor({ id, name, clientOptions, connectionProvider }: MonacoLanguageClientOptions) {
23
- super(id || name.toLowerCase(), name, clientOptions);
24
- this.connectionProvider = connectionProvider;
25
- }
26
-
27
- protected override createMessageTransports(encoding: string): Promise<MessageTransports> {
28
- return this.connectionProvider.get(encoding);
29
- }
30
- }
@@ -1,106 +0,0 @@
1
- /* --------------------------------------------------------------------------------------------
2
- * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- * ------------------------------------------------------------------------------------------ */
5
-
6
- import { editor, Environment } from 'monaco-editor';
7
- import { ILogService, initialize, IWorkbenchConstructionOptions, StandaloneServices } from 'vscode/services';
8
- import 'vscode/localExtensionHost';
9
- import { OpenEditor } from '@codingame/monaco-vscode-editor-service-override';
10
- import getLanguagesServiceOverride from '@codingame/monaco-vscode-languages-service-override';
11
- import getModelServiceOverride from '@codingame/monaco-vscode-model-service-override';
12
-
13
- export interface MonacoEnvironmentEnhanced extends Environment {
14
- vscodeApiInitialised: boolean;
15
- }
16
-
17
- export type InitializeServiceConfig = {
18
- userServices?: editor.IEditorOverrideServices;
19
- debugLogging?: boolean;
20
- workspaceConfig?: IWorkbenchConstructionOptions;
21
- };
22
-
23
- export const wasVscodeApiInitialized = () => {
24
- return (window.MonacoEnvironment as MonacoEnvironmentEnhanced)?.vscodeApiInitialised === true;
25
- };
26
-
27
- export const initServices = async (config?: InitializeServiceConfig) => {
28
- if (!wasVscodeApiInitialized()) {
29
- await importAllServices(config);
30
- if (config?.debugLogging === true) {
31
- console.log('Initialization of vscode services completed successfully.');
32
- }
33
- if (!window.MonacoEnvironment) {
34
- window.MonacoEnvironment = {};
35
- }
36
- (window.MonacoEnvironment as MonacoEnvironmentEnhanced).vscodeApiInitialised = true;
37
- } else {
38
- if (config?.debugLogging === true) {
39
- console.log('Initialization of vscode services can only performed once!');
40
- }
41
- }
42
- };
43
-
44
- export const useOpenEditorStub: OpenEditor = async (modelRef, options, sideBySide) => {
45
- console.log('Received open editor call with parameters: ', modelRef, options, sideBySide);
46
- return undefined;
47
- };
48
-
49
- export const reportServiceLoading = (services: editor.IEditorOverrideServices, debugLogging: boolean) => {
50
- for (const serviceName of Object.keys(services)) {
51
- if (debugLogging) {
52
- console.log(`Loading service: ${serviceName}`);
53
- }
54
- }
55
- };
56
-
57
- export const mergeServices = (services: editor.IEditorOverrideServices, overrideServices: editor.IEditorOverrideServices) => {
58
- for (const [name, service] of Object.entries(services)) {
59
- overrideServices[name] = service;
60
- }
61
- };
62
-
63
- /**
64
- * monaco-vscode-api automatically loads the following services:
65
- * - layout
66
- * - environment
67
- * - extension
68
- * - files
69
- * - quickAccess
70
- *
71
- * monaco-languageclient always adds the following services:
72
- * - languages
73
- * - model
74
- */
75
- export const importAllServices = async (config?: InitializeServiceConfig) => {
76
- const lc: InitializeServiceConfig = config ?? {};
77
- const userServices: editor.IEditorOverrideServices = lc.userServices ?? {};
78
-
79
- const mlcDefautServices = {
80
- ...getLanguagesServiceOverride(),
81
- ...getModelServiceOverride()
82
- };
83
- mergeServices(mlcDefautServices, userServices);
84
- reportServiceLoading(userServices, lc.debugLogging === true);
85
-
86
- const haveThemeService = Object.keys(userServices).includes('themeService');
87
- const haveTextmateService = Object.keys(userServices).includes('textMateTokenizationFeature');
88
- const haveMarkersService = Object.keys(userServices).includes('markersService');
89
- const haveViewsService = Object.keys(userServices).includes('viewsService');
90
-
91
- // theme requires textmate
92
- if (haveThemeService && !haveTextmateService) {
93
- throw new Error('"theme" service requires "textmate" service. Please add it to the "userServices".');
94
- }
95
-
96
- // markers service requires views service
97
- if (haveMarkersService && !haveViewsService) {
98
- throw new Error('"markers" service requires "views" service. Please add it to the "userServices".');
99
- }
100
-
101
- await initialize(userServices);
102
- const logLevel = lc.workspaceConfig?.developmentOptions?.logLevel;
103
- if (logLevel) {
104
- StandaloneServices.get(ILogService).setLevel(logLevel);
105
- }
106
- };