monaco-languageclient 8.2.0 → 8.3.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.
- package/CHANGELOG.md +9 -0
- package/lib/tools/index.d.ts +15 -0
- package/lib/tools/index.d.ts.map +1 -0
- package/lib/tools/index.js +32 -0
- package/lib/tools/index.js.map +1 -0
- package/lib/vscode/services.d.ts +10 -3
- package/lib/vscode/services.d.ts.map +1 -1
- package/lib/vscode/services.js +20 -20
- package/lib/vscode/services.js.map +1 -1
- package/package.json +17 -10
- package/src/tools/index.ts +44 -0
- package/src/vscode/services.ts +31 -20
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this npm module are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [8.3.1] - 2024-04-17
|
|
6
|
+
|
|
7
|
+
- Updated to version `4.3.2` of `@codingame/monaco-vscode` packages
|
|
8
|
+
|
|
9
|
+
## [8.3.0] - 2024-04-10
|
|
10
|
+
|
|
11
|
+
- Updated to version `4.2.1` of `@codingame/monaco-vscode` packages
|
|
12
|
+
- Introduce new export `tools` exposing the `Logger` migrated here from `monaco-editor-wrapper`
|
|
13
|
+
|
|
5
14
|
## [8.2.0] - 2024-04-10
|
|
6
15
|
|
|
7
16
|
- Updated to version `4.1.2` of `@codingame/monaco-vscode` packages
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type LoggerConfig = {
|
|
2
|
+
enabled: boolean;
|
|
3
|
+
debugEnabled?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare class Logger {
|
|
6
|
+
private enabled;
|
|
7
|
+
private debugEnabled;
|
|
8
|
+
constructor(config?: LoggerConfig);
|
|
9
|
+
updateConfig(config?: LoggerConfig): void;
|
|
10
|
+
isEnabled(): boolean;
|
|
11
|
+
isDebugEnabled(): boolean;
|
|
12
|
+
info(message: string): void;
|
|
13
|
+
debug(message: string, force?: boolean): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,YAAY,GAAG;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAA;CACzB,CAAC;AAEF,qBAAa,MAAM;IAEf,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,YAAY,CAAU;gBAElB,MAAM,CAAC,EAAE,YAAY;IAIjC,YAAY,CAAC,MAAM,CAAC,EAAE,YAAY;IAKlC,SAAS;IAIT,cAAc;IAId,IAAI,CAAC,OAAO,EAAE,MAAM;IAMpB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAKzC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* --------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) 2024 TypeFox and others.
|
|
3
|
+
* Licensed under the MIT License. See LICENSE in the package root for license information.
|
|
4
|
+
* ------------------------------------------------------------------------------------------ */
|
|
5
|
+
export class Logger {
|
|
6
|
+
enabled;
|
|
7
|
+
debugEnabled;
|
|
8
|
+
constructor(config) {
|
|
9
|
+
this.updateConfig(config);
|
|
10
|
+
}
|
|
11
|
+
updateConfig(config) {
|
|
12
|
+
this.enabled = !config ? true : config.enabled === true;
|
|
13
|
+
this.debugEnabled = this.enabled && config?.debugEnabled === true;
|
|
14
|
+
}
|
|
15
|
+
isEnabled() {
|
|
16
|
+
return this.enabled;
|
|
17
|
+
}
|
|
18
|
+
isDebugEnabled() {
|
|
19
|
+
return this.debugEnabled;
|
|
20
|
+
}
|
|
21
|
+
info(message) {
|
|
22
|
+
if (this.enabled) {
|
|
23
|
+
console.log(message);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
debug(message, force) {
|
|
27
|
+
if (this.enabled && (this.debugEnabled || force === true)) {
|
|
28
|
+
console.debug(message);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAOhG,MAAM,OAAO,MAAM;IAEP,OAAO,CAAU;IACjB,YAAY,CAAU;IAE9B,YAAY,MAAqB;QAC7B,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAED,YAAY,CAAC,MAAqB;QAC9B,IAAI,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAO,CAAC,OAAO,KAAK,IAAI,CAAC;QACzD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,IAAI,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IACtE,CAAC;IAED,SAAS;QACL,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,cAAc;QACV,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,IAAI,CAAC,OAAe;QAChB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,KAAe;QAClC,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,KAAK,KAAK,IAAI,CAAC,EAAE,CAAC;YACxD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACL,CAAC;CACJ"}
|
package/lib/vscode/services.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as monaco from 'monaco-editor';
|
|
|
2
2
|
import 'vscode/localExtensionHost';
|
|
3
3
|
import { IWorkbenchConstructionOptions } from 'vscode/services';
|
|
4
4
|
import type { LocalizationOptions } from '@codingame/monaco-vscode-localization-service-override';
|
|
5
|
+
import { Logger } from '../tools/index.js';
|
|
5
6
|
export interface MonacoEnvironmentEnhanced extends monaco.Environment {
|
|
6
7
|
vscodeInitialising?: boolean;
|
|
7
8
|
vscodeApiInitialised?: boolean;
|
|
@@ -16,9 +17,15 @@ export declare const initEnhancedMonacoEnvironment: () => MonacoEnvironmentEnhan
|
|
|
16
17
|
export declare const supplyRequiredServices: () => Promise<{
|
|
17
18
|
[x: string]: any;
|
|
18
19
|
}>;
|
|
19
|
-
export declare const reportServiceLoading: (services: monaco.editor.IEditorOverrideServices,
|
|
20
|
+
export declare const reportServiceLoading: (services: monaco.editor.IEditorOverrideServices, logger?: Logger) => void;
|
|
20
21
|
export declare const mergeServices: (services: monaco.editor.IEditorOverrideServices, overrideServices: monaco.editor.IEditorOverrideServices) => void;
|
|
21
|
-
export
|
|
22
|
+
export type InitServicesInstruction = {
|
|
23
|
+
serviceConfig?: InitializeServiceConfig;
|
|
24
|
+
caller?: string;
|
|
25
|
+
performChecks?: () => boolean;
|
|
26
|
+
logger?: Logger;
|
|
27
|
+
};
|
|
28
|
+
export declare const initServices: (instruction: InitServicesInstruction) => Promise<void>;
|
|
22
29
|
/**
|
|
23
30
|
* monaco-vscode-api automatically loads the following services:
|
|
24
31
|
* - layout
|
|
@@ -30,7 +37,7 @@ export declare const initServices: (config?: InitializeServiceConfig, caller?: s
|
|
|
30
37
|
* - languages
|
|
31
38
|
* - model
|
|
32
39
|
*/
|
|
33
|
-
export declare const importAllServices: (
|
|
40
|
+
export declare const importAllServices: (instruction: InitServicesInstruction) => Promise<void>;
|
|
34
41
|
/**
|
|
35
42
|
* Enable ext host to run in a worker
|
|
36
43
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/vscode/services.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;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IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,YAAY,gBAAuB,uBAAuB,kBAwBtE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,gBAAuB,uBAAuB,kBAkB3E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,wBAA+B,OAAO,gBAAgB,OAAO,MAAM,CAAC,uBAAuB,kBAa7H,CAAC;AAEF,eAAO,MAAM,gCAAgC,QAAO,mBA8DnD,CAAC"}
|
package/lib/vscode/services.js
CHANGED
|
@@ -8,6 +8,7 @@ import getExtensionServiceOverride from '@codingame/monaco-vscode-extensions-ser
|
|
|
8
8
|
import getLanguagesServiceOverride from '@codingame/monaco-vscode-languages-service-override';
|
|
9
9
|
import getModelServiceOverride from '@codingame/monaco-vscode-model-service-override';
|
|
10
10
|
import { FakeWorker as Worker } from './fakeWorker.js';
|
|
11
|
+
import { Logger } from '../tools/index.js';
|
|
11
12
|
export const initEnhancedMonacoEnvironment = () => {
|
|
12
13
|
const monWin = self;
|
|
13
14
|
if (!monWin.MonacoEnvironment) {
|
|
@@ -28,11 +29,9 @@ export const supplyRequiredServices = async () => {
|
|
|
28
29
|
...getModelServiceOverride()
|
|
29
30
|
};
|
|
30
31
|
};
|
|
31
|
-
export const reportServiceLoading = (services,
|
|
32
|
+
export const reportServiceLoading = (services, logger) => {
|
|
32
33
|
for (const serviceName of Object.keys(services)) {
|
|
33
|
-
|
|
34
|
-
console.log(`Loading service: ${serviceName}`);
|
|
35
|
-
}
|
|
34
|
+
logger?.debug(`Loading service: ${serviceName}`);
|
|
36
35
|
}
|
|
37
36
|
};
|
|
38
37
|
export const mergeServices = (services, overrideServices) => {
|
|
@@ -40,23 +39,24 @@ export const mergeServices = (services, overrideServices) => {
|
|
|
40
39
|
overrideServices[name] = service;
|
|
41
40
|
}
|
|
42
41
|
};
|
|
43
|
-
export const initServices = async (
|
|
42
|
+
export const initServices = async (instruction) => {
|
|
44
43
|
const envEnhanced = initEnhancedMonacoEnvironment();
|
|
44
|
+
// in case debugLogging is set and for whatever reason no logger is passed a proper one is created
|
|
45
|
+
if (instruction.serviceConfig?.debugLogging === true && !instruction.logger) {
|
|
46
|
+
instruction.logger = new Logger({
|
|
47
|
+
enabled: true,
|
|
48
|
+
debugEnabled: true
|
|
49
|
+
});
|
|
50
|
+
}
|
|
45
51
|
if (!envEnhanced.vscodeInitialising) {
|
|
46
52
|
if (envEnhanced.vscodeApiInitialised) {
|
|
47
|
-
|
|
48
|
-
console.log('Initialization of vscode services can only performed once!');
|
|
49
|
-
}
|
|
53
|
+
instruction.logger?.debug('Initialization of vscode services can only performed once!');
|
|
50
54
|
}
|
|
51
55
|
else {
|
|
52
56
|
envEnhanced.vscodeInitialising = true;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
await importAllServices(config, performChecks);
|
|
57
|
-
if (config?.debugLogging === true) {
|
|
58
|
-
console.log('Initialization of vscode services completed successfully.');
|
|
59
|
-
}
|
|
57
|
+
instruction.logger?.debug(`Initializing vscode services. Caller: ${instruction.caller ?? 'unknown'}`);
|
|
58
|
+
await importAllServices(instruction);
|
|
59
|
+
instruction.logger?.debug('Initialization of vscode services completed successfully.');
|
|
60
60
|
envEnhanced.vscodeApiInitialised = true;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -72,14 +72,14 @@ export const initServices = async (config, caller, performChecks) => {
|
|
|
72
72
|
* - languages
|
|
73
73
|
* - model
|
|
74
74
|
*/
|
|
75
|
-
export const importAllServices = async (
|
|
76
|
-
const lc =
|
|
75
|
+
export const importAllServices = async (instruction) => {
|
|
76
|
+
const lc = instruction.serviceConfig ?? {};
|
|
77
77
|
const userServices = lc.userServices ?? {};
|
|
78
78
|
const lcRequiredServices = await supplyRequiredServices();
|
|
79
79
|
mergeServices(lcRequiredServices, userServices);
|
|
80
|
-
await configureExtHostWorker(
|
|
81
|
-
reportServiceLoading(userServices,
|
|
82
|
-
if (performChecks === undefined || performChecks()) {
|
|
80
|
+
await configureExtHostWorker(instruction.serviceConfig?.enableExtHostWorker === true, userServices);
|
|
81
|
+
reportServiceLoading(userServices, instruction.logger);
|
|
82
|
+
if (instruction.performChecks === undefined || instruction.performChecks()) {
|
|
83
83
|
await initialize(userServices);
|
|
84
84
|
const logLevel = lc.workspaceConfig?.developmentOptions?.logLevel;
|
|
85
85
|
if (logLevel) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../src/vscode/services.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAiC,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE7G,OAAO,2BAA2B,MAAM,sDAAsD,CAAC;AAC/F,OAAO,2BAA2B,MAAM,qDAAqD,CAAC;AAC9F,OAAO,uBAAuB,MAAM,iDAAiD,CAAC;AAEtF,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../src/vscode/services.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAiC,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE7G,OAAO,2BAA2B,MAAM,sDAAsD,CAAC;AAC/F,OAAO,2BAA2B,MAAM,qDAAqD,CAAC;AAC9F,OAAO,uBAAuB,MAAM,iDAAiD,CAAC;AAEtF,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAc3C,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,EAAE;IAC9C,MAAM,MAAM,GAAI,IAAe,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC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ACjB,YAAY,EAAE,uBAAuB;aACxC,EAAE;gBACC,MAAM,EAAE,IAAI;gBACZ,YAAY,EAAE,SAAS;aAC1B,CAAC;KACL,CAAC;AACN,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monaco-languageclient",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.1",
|
|
4
4
|
"description": "Monaco Language client implementation",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TypeFox GmbH",
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
"types": "./lib/index.d.ts",
|
|
25
25
|
"default": "./lib/index.js"
|
|
26
26
|
},
|
|
27
|
+
"./tools": {
|
|
28
|
+
"types": "./lib/tools/index.d.ts",
|
|
29
|
+
"default": "./lib/tools/index.js"
|
|
30
|
+
},
|
|
27
31
|
"./vscode/services": {
|
|
28
32
|
"types": "./lib/vscode/services.d.ts",
|
|
29
33
|
"default": "./lib/vscode/services.js"
|
|
@@ -34,6 +38,9 @@
|
|
|
34
38
|
".": [
|
|
35
39
|
"lib/index.d.ts"
|
|
36
40
|
],
|
|
41
|
+
"tools": [
|
|
42
|
+
"lib/tools/index"
|
|
43
|
+
],
|
|
37
44
|
"vscode/services": [
|
|
38
45
|
"lib/vscode/services"
|
|
39
46
|
]
|
|
@@ -44,7 +51,7 @@
|
|
|
44
51
|
"npm": ">=9.0.0"
|
|
45
52
|
},
|
|
46
53
|
"volta": {
|
|
47
|
-
"node": "20.12.
|
|
54
|
+
"node": "20.12.2",
|
|
48
55
|
"npm": "10.5.0"
|
|
49
56
|
},
|
|
50
57
|
"files": [
|
|
@@ -55,17 +62,17 @@
|
|
|
55
62
|
"LICENSE"
|
|
56
63
|
],
|
|
57
64
|
"dependencies": {
|
|
58
|
-
"@codingame/monaco-vscode-extensions-service-override": "~4.
|
|
59
|
-
"@codingame/monaco-vscode-languages-service-override": "~4.
|
|
60
|
-
"@codingame/monaco-vscode-localization-service-override": "~4.
|
|
61
|
-
"@codingame/monaco-vscode-model-service-override": "~4.
|
|
62
|
-
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~4.
|
|
63
|
-
"vscode": "npm:@codingame/monaco-vscode-api@~4.
|
|
65
|
+
"@codingame/monaco-vscode-extensions-service-override": "~4.3.2",
|
|
66
|
+
"@codingame/monaco-vscode-languages-service-override": "~4.3.2",
|
|
67
|
+
"@codingame/monaco-vscode-localization-service-override": "~4.3.2",
|
|
68
|
+
"@codingame/monaco-vscode-model-service-override": "~4.3.2",
|
|
69
|
+
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~4.3.2",
|
|
70
|
+
"vscode": "npm:@codingame/monaco-vscode-api@~4.3.2",
|
|
64
71
|
"vscode-languageclient": "~9.0.1"
|
|
65
72
|
},
|
|
66
73
|
"peerDependencies": {
|
|
67
|
-
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~4.
|
|
68
|
-
"vscode": "npm:@codingame/monaco-vscode-api@~4.
|
|
74
|
+
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~4.3.2",
|
|
75
|
+
"vscode": "npm:@codingame/monaco-vscode-api@~4.3.2"
|
|
69
76
|
},
|
|
70
77
|
"peerDependenciesMeta": {
|
|
71
78
|
"monaco-editor": {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* --------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) 2024 TypeFox and others.
|
|
3
|
+
* Licensed under the MIT License. See LICENSE in the package root for license information.
|
|
4
|
+
* ------------------------------------------------------------------------------------------ */
|
|
5
|
+
|
|
6
|
+
export type LoggerConfig = {
|
|
7
|
+
enabled: boolean,
|
|
8
|
+
debugEnabled?: boolean
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export class Logger {
|
|
12
|
+
|
|
13
|
+
private enabled: boolean;
|
|
14
|
+
private debugEnabled: boolean;
|
|
15
|
+
|
|
16
|
+
constructor(config?: LoggerConfig) {
|
|
17
|
+
this.updateConfig(config);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
updateConfig(config?: LoggerConfig) {
|
|
21
|
+
this.enabled = !config ? true : config!.enabled === true;
|
|
22
|
+
this.debugEnabled = this.enabled && config?.debugEnabled === true;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
isEnabled() {
|
|
26
|
+
return this.enabled;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
isDebugEnabled() {
|
|
30
|
+
return this.debugEnabled;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
info(message: string) {
|
|
34
|
+
if (this.enabled) {
|
|
35
|
+
console.log(message);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
debug(message: string, force?: boolean) {
|
|
40
|
+
if (this.enabled && (this.debugEnabled || force === true)) {
|
|
41
|
+
console.debug(message);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
package/src/vscode/services.ts
CHANGED
|
@@ -12,6 +12,7 @@ import getLanguagesServiceOverride from '@codingame/monaco-vscode-languages-serv
|
|
|
12
12
|
import getModelServiceOverride from '@codingame/monaco-vscode-model-service-override';
|
|
13
13
|
import type { LocalizationOptions } from '@codingame/monaco-vscode-localization-service-override';
|
|
14
14
|
import { FakeWorker as Worker } from './fakeWorker.js';
|
|
15
|
+
import { Logger } from '../tools/index.js';
|
|
15
16
|
|
|
16
17
|
export interface MonacoEnvironmentEnhanced extends monaco.Environment {
|
|
17
18
|
vscodeInitialising?: boolean;
|
|
@@ -48,11 +49,9 @@ export const supplyRequiredServices = async () => {
|
|
|
48
49
|
};
|
|
49
50
|
};
|
|
50
51
|
|
|
51
|
-
export const reportServiceLoading = (services: monaco.editor.IEditorOverrideServices,
|
|
52
|
+
export const reportServiceLoading = (services: monaco.editor.IEditorOverrideServices, logger?: Logger) => {
|
|
52
53
|
for (const serviceName of Object.keys(services)) {
|
|
53
|
-
|
|
54
|
-
console.log(`Loading service: ${serviceName}`);
|
|
55
|
-
}
|
|
54
|
+
logger?.debug(`Loading service: ${serviceName}`);
|
|
56
55
|
}
|
|
57
56
|
};
|
|
58
57
|
|
|
@@ -62,23 +61,34 @@ export const mergeServices = (services: monaco.editor.IEditorOverrideServices, o
|
|
|
62
61
|
}
|
|
63
62
|
};
|
|
64
63
|
|
|
65
|
-
export
|
|
64
|
+
export type InitServicesInstruction = {
|
|
65
|
+
serviceConfig?: InitializeServiceConfig;
|
|
66
|
+
caller?: string;
|
|
67
|
+
performChecks?: () => boolean;
|
|
68
|
+
logger?: Logger;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const initServices = async (instruction: InitServicesInstruction) => {
|
|
66
72
|
const envEnhanced = initEnhancedMonacoEnvironment();
|
|
67
73
|
|
|
74
|
+
// in case debugLogging is set and for whatever reason no logger is passed a proper one is created
|
|
75
|
+
if (instruction.serviceConfig?.debugLogging === true && !instruction.logger) {
|
|
76
|
+
instruction.logger = new Logger({
|
|
77
|
+
enabled: true,
|
|
78
|
+
debugEnabled: true
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
68
82
|
if (!envEnhanced.vscodeInitialising) {
|
|
69
83
|
if (envEnhanced.vscodeApiInitialised) {
|
|
70
|
-
|
|
71
|
-
console.log('Initialization of vscode services can only performed once!');
|
|
72
|
-
}
|
|
84
|
+
instruction.logger?.debug('Initialization of vscode services can only performed once!');
|
|
73
85
|
} else {
|
|
74
86
|
envEnhanced.vscodeInitialising = true;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
console.log('Initialization of vscode services completed successfully.');
|
|
81
|
-
}
|
|
87
|
+
instruction.logger?.debug(`Initializing vscode services. Caller: ${instruction.caller ?? 'unknown'}`);
|
|
88
|
+
|
|
89
|
+
await importAllServices(instruction);
|
|
90
|
+
instruction.logger?.debug('Initialization of vscode services completed successfully.');
|
|
91
|
+
|
|
82
92
|
envEnhanced.vscodeApiInitialised = true;
|
|
83
93
|
}
|
|
84
94
|
}
|
|
@@ -95,17 +105,18 @@ export const initServices = async (config?: InitializeServiceConfig, caller?: st
|
|
|
95
105
|
* - languages
|
|
96
106
|
* - model
|
|
97
107
|
*/
|
|
98
|
-
export const importAllServices = async (
|
|
99
|
-
const lc: InitializeServiceConfig =
|
|
108
|
+
export const importAllServices = async (instruction: InitServicesInstruction) => {
|
|
109
|
+
const lc: InitializeServiceConfig = instruction.serviceConfig ?? {};
|
|
100
110
|
const userServices: monaco.editor.IEditorOverrideServices = lc.userServices ?? {};
|
|
101
111
|
|
|
102
112
|
const lcRequiredServices = await supplyRequiredServices();
|
|
103
113
|
|
|
104
114
|
mergeServices(lcRequiredServices, userServices);
|
|
105
|
-
await configureExtHostWorker(
|
|
106
|
-
|
|
115
|
+
await configureExtHostWorker(instruction.serviceConfig?.enableExtHostWorker === true, userServices);
|
|
116
|
+
|
|
117
|
+
reportServiceLoading(userServices, instruction.logger);
|
|
107
118
|
|
|
108
|
-
if (performChecks === undefined || performChecks()) {
|
|
119
|
+
if (instruction.performChecks === undefined || instruction.performChecks()) {
|
|
109
120
|
await initialize(userServices);
|
|
110
121
|
const logLevel = lc.workspaceConfig?.developmentOptions?.logLevel;
|
|
111
122
|
if (logLevel) {
|