monaco-languageclient 8.8.2 → 9.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.
- package/CHANGELOG.md +13 -0
- package/lib/client.d.ts +13 -0
- package/lib/client.d.ts.map +1 -0
- package/lib/client.js +16 -0
- package/lib/client.js.map +1 -0
- package/lib/commonTypes.d.ts +47 -0
- package/lib/commonTypes.d.ts.map +1 -0
- package/lib/commonTypes.js +6 -0
- package/lib/commonTypes.js.map +1 -0
- package/lib/index.d.ts +2 -15
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -11
- package/lib/index.js.map +1 -1
- package/lib/tools/index.d.ts +1 -14
- package/lib/tools/index.d.ts.map +1 -1
- package/lib/tools/index.js +1 -27
- package/lib/tools/index.js.map +1 -1
- package/lib/tools/logging.d.ts +10 -0
- package/lib/tools/logging.d.ts.map +1 -0
- package/lib/tools/logging.js +18 -0
- package/lib/tools/logging.js.map +1 -0
- package/lib/vscode/index.d.ts +3 -0
- package/lib/vscode/index.d.ts.map +1 -0
- package/lib/vscode/index.js +7 -0
- package/lib/vscode/index.js.map +1 -0
- package/lib/vscode/services.d.ts +10 -12
- package/lib/vscode/services.d.ts.map +1 -1
- package/lib/vscode/services.js +15 -23
- package/lib/vscode/services.js.map +1 -1
- package/package.json +15 -14
- package/src/client.ts +26 -0
- package/src/commonTypes.ts +60 -0
- package/src/index.ts +2 -25
- package/src/tools/index.ts +1 -39
- package/src/tools/logging.ts +26 -0
- package/src/vscode/index.ts +7 -0
- package/src/vscode/services.ts +24 -34
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this npm module are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [9.0.0-next.1] - 2024-09-xy
|
|
6
|
+
|
|
7
|
+
- Update to monaco-vscode-api 9.0.x [#749](https://github.com/TypeFox/monaco-languageclient/pull/749)
|
|
8
|
+
- Updated all `@codingame/monaco-vscode` packages to `9.0.3`.
|
|
9
|
+
- Enhancements to logging
|
|
10
|
+
- monaco-languageclient config improvement, wrapper+languageclientwrapper improvements [#741](https://github.com/TypeFox/monaco-languageclient/pull/741)
|
|
11
|
+
- Pass MessageTransports directly
|
|
12
|
+
- Allows to configure more than one language client
|
|
13
|
+
|
|
14
|
+
## [8.8.3] - 2024-08-26
|
|
15
|
+
|
|
16
|
+
- Update to monaco-vscode-api 8.0.4 (monaco-editor 0.51.0)
|
|
17
|
+
|
|
5
18
|
## [8.8.2] - 2024-08-21
|
|
6
19
|
|
|
7
20
|
- Update to monaco-vscode-api 8.0.2
|
package/lib/client.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseLanguageClient, MessageTransports, LanguageClientOptions } from 'vscode-languageclient/browser.js';
|
|
2
|
+
export type MonacoLanguageClientOptions = {
|
|
3
|
+
name: string;
|
|
4
|
+
id?: string;
|
|
5
|
+
clientOptions: LanguageClientOptions;
|
|
6
|
+
messageTransports: MessageTransports;
|
|
7
|
+
};
|
|
8
|
+
export declare class MonacoLanguageClient extends BaseLanguageClient {
|
|
9
|
+
protected readonly messageTransports: MessageTransports;
|
|
10
|
+
constructor({ id, name, clientOptions, messageTransports }: MonacoLanguageClientOptions);
|
|
11
|
+
protected createMessageTransports(_encoding: string): Promise<MessageTransports>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEhH,MAAM,MAAM,2BAA2B,GAAG;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,qBAAqB,CAAC;IACrC,iBAAiB,EAAE,iBAAiB,CAAC;CACxC,CAAA;AAED,qBAAa,oBAAqB,SAAQ,kBAAkB;IACxD,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;gBAE5C,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,iBAAiB,EAAE,EAAE,2BAA2B;cAKpE,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAG5F"}
|
package/lib/client.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
import { BaseLanguageClient } from 'vscode-languageclient/browser.js';
|
|
6
|
+
export class MonacoLanguageClient extends BaseLanguageClient {
|
|
7
|
+
messageTransports;
|
|
8
|
+
constructor({ id, name, clientOptions, messageTransports }) {
|
|
9
|
+
super(id ?? name.toLowerCase(), name, clientOptions);
|
|
10
|
+
this.messageTransports = messageTransports;
|
|
11
|
+
}
|
|
12
|
+
createMessageTransports(_encoding) {
|
|
13
|
+
return Promise.resolve(this.messageTransports);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,kBAAkB,EAA4C,MAAM,kCAAkC,CAAC;AAShH,MAAM,OAAO,oBAAqB,SAAQ,kBAAkB;IACrC,iBAAiB,CAAoB;IAExD,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,iBAAiB,EAA+B;QACnF,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;QACrD,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC/C,CAAC;IAEkB,uBAAuB,CAAC,SAAiB;QACxD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACnD,CAAC;CACJ"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { MonacoLanguageClient } from './client.js';
|
|
2
|
+
export type ConnetionConfigOptions = WebSocketConfigOptionsDirect | WebSocketConfigOptionsParams | WebSocketConfigOptionsUrl | WorkerConfigOptionsParams | WorkerConfigOptionsDirect;
|
|
3
|
+
export interface WebSocketCallOptions {
|
|
4
|
+
/** Adds handle on languageClient */
|
|
5
|
+
onCall: (languageClient?: MonacoLanguageClient) => void;
|
|
6
|
+
/** Reports Status Of Language Client */
|
|
7
|
+
reportStatus?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface WebSocketConfigOptionsDirect {
|
|
10
|
+
$type: 'WebSocketDirect';
|
|
11
|
+
webSocket: WebSocket;
|
|
12
|
+
startOptions?: WebSocketCallOptions;
|
|
13
|
+
stopOptions?: WebSocketCallOptions;
|
|
14
|
+
}
|
|
15
|
+
export interface WebSocketUrlParams {
|
|
16
|
+
secured: boolean;
|
|
17
|
+
host: string;
|
|
18
|
+
port?: number;
|
|
19
|
+
path?: string;
|
|
20
|
+
extraParams?: Record<string, string | number | Array<string | number>>;
|
|
21
|
+
}
|
|
22
|
+
export interface WebSocketConfigOptionsParams extends WebSocketUrlParams {
|
|
23
|
+
$type: 'WebSocketParams';
|
|
24
|
+
startOptions?: WebSocketCallOptions;
|
|
25
|
+
stopOptions?: WebSocketCallOptions;
|
|
26
|
+
}
|
|
27
|
+
export interface WebSocketUrlString {
|
|
28
|
+
url: string;
|
|
29
|
+
}
|
|
30
|
+
export interface WebSocketConfigOptionsUrl extends WebSocketUrlString {
|
|
31
|
+
$type: 'WebSocketUrl';
|
|
32
|
+
startOptions?: WebSocketCallOptions;
|
|
33
|
+
stopOptions?: WebSocketCallOptions;
|
|
34
|
+
}
|
|
35
|
+
export interface WorkerConfigOptionsParams {
|
|
36
|
+
$type: 'WorkerConfig';
|
|
37
|
+
url: URL;
|
|
38
|
+
type: 'classic' | 'module';
|
|
39
|
+
messagePort?: MessagePort;
|
|
40
|
+
workerName?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface WorkerConfigOptionsDirect {
|
|
43
|
+
$type: 'WorkerDirect';
|
|
44
|
+
worker: Worker;
|
|
45
|
+
messagePort?: MessagePort;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=commonTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonTypes.d.ts","sourceRoot":"","sources":["../src/commonTypes.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,MAAM,sBAAsB,GAAG,4BAA4B,GAAG,4BAA4B,GAAG,yBAAyB,GAAG,yBAAyB,GAAG,yBAAyB,CAAC;AAErL,MAAM,WAAW,oBAAoB;IACjC,oCAAoC;IACpC,MAAM,EAAE,CAAC,cAAc,CAAC,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACxD,wCAAwC;IACxC,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,4BAA4B;IACzC,KAAK,EAAE,iBAAiB,CAAA;IACxB,SAAS,EAAE,SAAS,CAAA;IACpB,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACtC;AAED,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;CAC1E;AAED,MAAM,WAAW,4BAA6B,SAAQ,kBAAkB;IACpE,KAAK,EAAE,iBAAiB,CAAA;IACxB,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACtC;AAED,MAAM,WAAW,kBAAkB;IAC/B,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,yBAA0B,SAAQ,kBAAkB;IACjE,KAAK,EAAE,cAAc,CAAA;IACrB,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACtC;AAED,MAAM,WAAW,yBAAyB;IACtC,KAAK,EAAE,cAAc,CAAA;IACrB,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC3B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,yBAAyB;IACtC,KAAK,EAAE,cAAc,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,WAAW,CAAC;CAC7B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
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 {};
|
|
6
|
+
//# sourceMappingURL=commonTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonTypes.js","sourceRoot":"","sources":["../src/commonTypes.ts"],"names":[],"mappings":"AAAA;;;gGAGgG"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
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
|
-
}
|
|
1
|
+
export * from './client.js';
|
|
2
|
+
export * from './commonTypes.js';
|
|
16
3
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2024 TypeFox and others.
|
|
3
3
|
* Licensed under the MIT License. See LICENSE in the package root for license information.
|
|
4
4
|
* ------------------------------------------------------------------------------------------ */
|
|
5
|
-
|
|
6
|
-
export
|
|
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
|
-
}
|
|
5
|
+
export * from './client.js';
|
|
6
|
+
export * from './commonTypes.js';
|
|
16
7
|
//# 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;AAEhG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
package/lib/tools/index.d.ts
CHANGED
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
export
|
|
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
|
-
}
|
|
1
|
+
export * from './logging.js';
|
|
15
2
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/tools/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAKA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAKA,cAAc,cAAc,CAAC"}
|
package/lib/tools/index.js
CHANGED
|
@@ -2,31 +2,5 @@
|
|
|
2
2
|
* Copyright (c) 2024 TypeFox and others.
|
|
3
3
|
* Licensed under the MIT License. See LICENSE in the package root for license information.
|
|
4
4
|
* ------------------------------------------------------------------------------------------ */
|
|
5
|
-
export
|
|
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
|
-
}
|
|
5
|
+
export * from './logging.js';
|
|
32
6
|
//# sourceMappingURL=index.js.map
|
package/lib/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ConsoleLogger as VSCodeConsoleLogger, ILogger } from '@codingame/monaco-vscode-log-service-override';
|
|
2
|
+
import { LogLevel } from 'vscode/services';
|
|
3
|
+
export interface Logger extends ILogger {
|
|
4
|
+
createErrorAndLog(message: string, ...params: unknown[]): Error;
|
|
5
|
+
}
|
|
6
|
+
export declare class ConsoleLogger extends VSCodeConsoleLogger {
|
|
7
|
+
constructor(logLevel?: LogLevel, useColors?: boolean);
|
|
8
|
+
createErrorAndLog(message: string, ...params: unknown[]): Error;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=logging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../src/tools/logging.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,IAAI,mBAAmB,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AAC9G,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,WAAW,MAAO,SAAQ,OAAO;IACnC,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;CACnE;AAED,qBAAa,aAAc,SAAQ,mBAAmB;gBAEtC,QAAQ,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,OAAO;IAIpD,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE;CAO1D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
import { ConsoleLogger as VSCodeConsoleLogger } from '@codingame/monaco-vscode-log-service-override';
|
|
6
|
+
import { LogLevel } from 'vscode/services';
|
|
7
|
+
export class ConsoleLogger extends VSCodeConsoleLogger {
|
|
8
|
+
constructor(logLevel, useColors) {
|
|
9
|
+
super(logLevel ?? LogLevel.Off, useColors);
|
|
10
|
+
}
|
|
11
|
+
createErrorAndLog(message, ...params) {
|
|
12
|
+
if (this.getLevel() >= LogLevel.Error) {
|
|
13
|
+
this.error(message, ...params);
|
|
14
|
+
}
|
|
15
|
+
return new Error(message);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=logging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../src/tools/logging.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,aAAa,IAAI,mBAAmB,EAAW,MAAM,+CAA+C,CAAC;AAC9G,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAM3C,MAAM,OAAO,aAAc,SAAQ,mBAAmB;IAElD,YAAY,QAAmB,EAAE,SAAmB;QAChD,KAAK,CAAC,QAAQ,IAAI,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED,iBAAiB,CAAC,OAAe,EAAE,GAAG,MAAiB;QACnD,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;YACpC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;CAEJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vscode/index.ts"],"names":[],"mappings":"AAKA,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
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 * from './fakeWorker.js';
|
|
6
|
+
export * from './services.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vscode/index.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
|
package/lib/vscode/services.d.ts
CHANGED
|
@@ -2,30 +2,28 @@ 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 '
|
|
5
|
+
import { Logger } from 'monaco-languageclient/tools';
|
|
6
6
|
export interface MonacoEnvironmentEnhanced extends monaco.Environment {
|
|
7
7
|
vscodeInitialising?: boolean;
|
|
8
8
|
vscodeApiInitialised?: boolean;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export interface InitializeServiceConfig {
|
|
11
11
|
userServices?: monaco.editor.IEditorOverrideServices;
|
|
12
12
|
enableExtHostWorker?: boolean;
|
|
13
|
-
debugLogging?: boolean;
|
|
14
13
|
workspaceConfig?: IWorkbenchConstructionOptions;
|
|
15
|
-
}
|
|
14
|
+
}
|
|
15
|
+
export interface InitServicesInstructions extends InitializeServiceConfig {
|
|
16
|
+
caller?: string;
|
|
17
|
+
performChecks?: () => boolean;
|
|
18
|
+
logger?: Logger;
|
|
19
|
+
}
|
|
16
20
|
export declare const initEnhancedMonacoEnvironment: () => MonacoEnvironmentEnhanced;
|
|
17
21
|
export declare const supplyRequiredServices: () => Promise<{
|
|
18
22
|
[x: string]: any;
|
|
19
23
|
}>;
|
|
20
24
|
export declare const reportServiceLoading: (services: monaco.editor.IEditorOverrideServices, logger?: Logger) => void;
|
|
21
25
|
export declare const mergeServices: (services: monaco.editor.IEditorOverrideServices, overrideServices: monaco.editor.IEditorOverrideServices) => void;
|
|
22
|
-
export
|
|
23
|
-
serviceConfig?: InitializeServiceConfig;
|
|
24
|
-
caller?: string;
|
|
25
|
-
performChecks?: () => boolean;
|
|
26
|
-
logger?: Logger;
|
|
27
|
-
};
|
|
28
|
-
export declare const initServices: (instruction: InitServicesInstruction) => Promise<void>;
|
|
26
|
+
export declare const initServices: (instructions: InitServicesInstructions) => Promise<void>;
|
|
29
27
|
/**
|
|
30
28
|
* monaco-vscode-api automatically loads the following services:
|
|
31
29
|
* - layout
|
|
@@ -37,7 +35,7 @@ export declare const initServices: (instruction: InitServicesInstruction) => Pro
|
|
|
37
35
|
* - languages
|
|
38
36
|
* - model
|
|
39
37
|
*/
|
|
40
|
-
export declare const importAllServices: (
|
|
38
|
+
export declare const importAllServices: (instructions: InitServicesInstructions) => Promise<void>;
|
|
41
39
|
/**
|
|
42
40
|
* Enable ext host to run in a worker
|
|
43
41
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/vscode/services.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAA2B,6BAA6B,EAAgC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/vscode/services.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAA2B,6BAA6B,EAAgC,MAAM,iBAAiB,CAAC;AAMvH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAGrD,MAAM,WAAW,yBAA0B,SAAQ,MAAM,CAAC,WAAW;IACjE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,MAAM,WAAW,uBAAuB;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAC;IACrD,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,eAAe,CAAC,EAAE,6BAA6B,CAAC;CACnD;AAED,MAAM,WAAW,wBAAyB,SAAQ,uBAAuB;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,6BAA6B,iCAczC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;EAMlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,aAAc,MAAM,CAAC,MAAM,CAAC,uBAAuB,WAAW,MAAM,SAIpG,CAAC;AAEF,eAAO,MAAM,aAAa,aAAc,MAAM,CAAC,MAAM,CAAC,uBAAuB,oBAAoB,MAAM,CAAC,MAAM,CAAC,uBAAuB,SAIrI,CAAC;AAEF,eAAO,MAAM,YAAY,iBAAwB,wBAAwB,kBAgBxE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,iBAAwB,wBAAwB,kBAc7E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,wBAA+B,OAAO,gBAAgB,MAAM,CAAC,MAAM,CAAC,uBAAuB,kBAa7H,CAAC;AAEF,eAAO,MAAM,gCAAgC,QAAO,mBA8DnD,CAAC"}
|
package/lib/vscode/services.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* Licensed under the MIT License. See LICENSE in the package root for license information.
|
|
4
4
|
* ------------------------------------------------------------------------------------------ */
|
|
5
5
|
import 'vscode/localExtensionHost';
|
|
6
|
-
import { ILogService, initialize,
|
|
6
|
+
import { ILogService, initialize, StandaloneServices, LogLevel } from 'vscode/services';
|
|
7
7
|
import getExtensionServiceOverride from '@codingame/monaco-vscode-extensions-service-override';
|
|
8
8
|
import getLanguagesServiceOverride from '@codingame/monaco-vscode-languages-service-override';
|
|
9
9
|
import getModelServiceOverride from '@codingame/monaco-vscode-model-service-override';
|
|
10
|
+
import getLogServiceOverride from '@codingame/monaco-vscode-log-service-override';
|
|
10
11
|
import { FakeWorker as Worker } from './fakeWorker.js';
|
|
11
|
-
import { Logger } from '../tools/index.js';
|
|
12
12
|
export const initEnhancedMonacoEnvironment = () => {
|
|
13
13
|
const monWin = self;
|
|
14
14
|
if (!monWin.MonacoEnvironment) {
|
|
@@ -26,6 +26,7 @@ export const initEnhancedMonacoEnvironment = () => {
|
|
|
26
26
|
export const supplyRequiredServices = async () => {
|
|
27
27
|
return {
|
|
28
28
|
...getLanguagesServiceOverride(),
|
|
29
|
+
...getLogServiceOverride(),
|
|
29
30
|
...getModelServiceOverride()
|
|
30
31
|
};
|
|
31
32
|
};
|
|
@@ -39,24 +40,17 @@ export const mergeServices = (services, overrideServices) => {
|
|
|
39
40
|
overrideServices[name] = service;
|
|
40
41
|
}
|
|
41
42
|
};
|
|
42
|
-
export const initServices = async (
|
|
43
|
+
export const initServices = async (instructions) => {
|
|
43
44
|
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
|
-
}
|
|
51
45
|
if (!(envEnhanced.vscodeInitialising ?? false)) {
|
|
52
46
|
if (envEnhanced.vscodeApiInitialised ?? false) {
|
|
53
|
-
|
|
47
|
+
instructions.logger?.debug('Initialization of vscode services can only performed once!');
|
|
54
48
|
}
|
|
55
49
|
else {
|
|
56
50
|
envEnhanced.vscodeInitialising = true;
|
|
57
|
-
|
|
58
|
-
await importAllServices(
|
|
59
|
-
|
|
51
|
+
instructions.logger?.debug(`Initializing vscode services. Caller: ${instructions.caller ?? 'unknown'}`);
|
|
52
|
+
await importAllServices(instructions);
|
|
53
|
+
instructions.logger?.debug('Initialization of vscode services completed successfully.');
|
|
60
54
|
envEnhanced.vscodeApiInitialised = true;
|
|
61
55
|
}
|
|
62
56
|
}
|
|
@@ -72,17 +66,15 @@ export const initServices = async (instruction) => {
|
|
|
72
66
|
* - languages
|
|
73
67
|
* - model
|
|
74
68
|
*/
|
|
75
|
-
export const importAllServices = async (
|
|
76
|
-
const
|
|
77
|
-
const userServices = lc.userServices ?? {};
|
|
69
|
+
export const importAllServices = async (instructions) => {
|
|
70
|
+
const userServices = instructions.userServices ?? {};
|
|
78
71
|
const lcRequiredServices = await supplyRequiredServices();
|
|
79
72
|
mergeServices(lcRequiredServices, userServices);
|
|
80
|
-
await configureExtHostWorker(
|
|
81
|
-
reportServiceLoading(userServices,
|
|
82
|
-
if (
|
|
83
|
-
await initialize(userServices, undefined,
|
|
84
|
-
|
|
85
|
-
StandaloneServices.get(ILogService).setLevel(logLevel);
|
|
73
|
+
await configureExtHostWorker(instructions.enableExtHostWorker === true, userServices);
|
|
74
|
+
reportServiceLoading(userServices, instructions.logger);
|
|
75
|
+
if (instructions.performChecks === undefined || (typeof instructions.performChecks === 'function' && instructions.performChecks())) {
|
|
76
|
+
await initialize(userServices, undefined, instructions.workspaceConfig);
|
|
77
|
+
StandaloneServices.get(ILogService).setLevel(instructions.logger?.getLevel() ?? LogLevel.Off);
|
|
86
78
|
}
|
|
87
79
|
};
|
|
88
80
|
/**
|
|
@@ -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,
|
|
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,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEvH,OAAO,2BAA2B,MAAM,sDAAsD,CAAC;AAC/F,OAAO,2BAA2B,MAAM,qDAAqD,CAAC;AAC9F,OAAO,uBAAuB,MAAM,iDAAiD,CAAC;AACtF,OAAO,qBAAqB,MAAM,+CAA+C,CAAC;AAGlF,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAmBvD,MAAM,CAAC,MAAM,6BAA6B,GAAG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CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monaco-languageclient",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0-next.1",
|
|
4
4
|
"description": "Monaco Language client implementation",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TypeFox GmbH",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"default": "./lib/tools/index.js"
|
|
30
30
|
},
|
|
31
31
|
"./vscode/services": {
|
|
32
|
-
"types": "./lib/vscode/
|
|
33
|
-
"default": "./lib/vscode/
|
|
32
|
+
"types": "./lib/vscode/index.d.ts",
|
|
33
|
+
"default": "./lib/vscode/index.js"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"typesVersions": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"lib/tools/index"
|
|
43
43
|
],
|
|
44
44
|
"vscode/services": [
|
|
45
|
-
"lib/vscode/
|
|
45
|
+
"lib/vscode/index"
|
|
46
46
|
]
|
|
47
47
|
}
|
|
48
48
|
},
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"npm": ">=9.0.0"
|
|
52
52
|
},
|
|
53
53
|
"volta": {
|
|
54
|
-
"node": "20.
|
|
55
|
-
"npm": "10.8.
|
|
54
|
+
"node": "20.17.0",
|
|
55
|
+
"npm": "10.8.3"
|
|
56
56
|
},
|
|
57
57
|
"files": [
|
|
58
58
|
"lib",
|
|
@@ -62,17 +62,18 @@
|
|
|
62
62
|
"LICENSE"
|
|
63
63
|
],
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@codingame/monaco-vscode-extensions-service-override": "~
|
|
66
|
-
"@codingame/monaco-vscode-languages-service-override": "~
|
|
67
|
-
"@codingame/monaco-vscode-localization-service-override": "~
|
|
68
|
-
"@codingame/monaco-vscode-
|
|
69
|
-
"
|
|
70
|
-
"
|
|
65
|
+
"@codingame/monaco-vscode-extensions-service-override": "~9.0.3",
|
|
66
|
+
"@codingame/monaco-vscode-languages-service-override": "~9.0.3",
|
|
67
|
+
"@codingame/monaco-vscode-localization-service-override": "~9.0.3",
|
|
68
|
+
"@codingame/monaco-vscode-log-service-override": "~9.0.3",
|
|
69
|
+
"@codingame/monaco-vscode-model-service-override": "~9.0.3",
|
|
70
|
+
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~9.0.3",
|
|
71
|
+
"vscode": "npm:@codingame/monaco-vscode-api@~9.0.3",
|
|
71
72
|
"vscode-languageclient": "~9.0.1"
|
|
72
73
|
},
|
|
73
74
|
"peerDependencies": {
|
|
74
|
-
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~
|
|
75
|
-
"vscode": "npm:@codingame/monaco-vscode-api@~
|
|
75
|
+
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~9.0.3",
|
|
76
|
+
"vscode": "npm:@codingame/monaco-vscode-api@~9.0.3"
|
|
76
77
|
},
|
|
77
78
|
"peerDependenciesMeta": {
|
|
78
79
|
"monaco-editor": {
|
package/src/client.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
import { BaseLanguageClient, MessageTransports, LanguageClientOptions } from 'vscode-languageclient/browser.js';
|
|
7
|
+
|
|
8
|
+
export type MonacoLanguageClientOptions = {
|
|
9
|
+
name: string;
|
|
10
|
+
id?: string;
|
|
11
|
+
clientOptions: LanguageClientOptions;
|
|
12
|
+
messageTransports: MessageTransports;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class MonacoLanguageClient extends BaseLanguageClient {
|
|
16
|
+
protected readonly messageTransports: MessageTransports;
|
|
17
|
+
|
|
18
|
+
constructor({ id, name, clientOptions, messageTransports }: MonacoLanguageClientOptions) {
|
|
19
|
+
super(id ?? name.toLowerCase(), name, clientOptions);
|
|
20
|
+
this.messageTransports = messageTransports;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
protected override createMessageTransports(_encoding: string): Promise<MessageTransports> {
|
|
24
|
+
return Promise.resolve(this.messageTransports);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
import { MonacoLanguageClient } from './client.js';
|
|
7
|
+
|
|
8
|
+
export type ConnetionConfigOptions = WebSocketConfigOptionsDirect | WebSocketConfigOptionsParams | WebSocketConfigOptionsUrl | WorkerConfigOptionsParams | WorkerConfigOptionsDirect;
|
|
9
|
+
|
|
10
|
+
export interface WebSocketCallOptions {
|
|
11
|
+
/** Adds handle on languageClient */
|
|
12
|
+
onCall: (languageClient?: MonacoLanguageClient) => void;
|
|
13
|
+
/** Reports Status Of Language Client */
|
|
14
|
+
reportStatus?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface WebSocketConfigOptionsDirect {
|
|
18
|
+
$type: 'WebSocketDirect'
|
|
19
|
+
webSocket: WebSocket
|
|
20
|
+
startOptions?: WebSocketCallOptions;
|
|
21
|
+
stopOptions?: WebSocketCallOptions;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface WebSocketUrlParams {
|
|
25
|
+
secured: boolean;
|
|
26
|
+
host: string;
|
|
27
|
+
port?: number;
|
|
28
|
+
path?: string;
|
|
29
|
+
extraParams?: Record<string, string | number | Array<string | number>>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface WebSocketConfigOptionsParams extends WebSocketUrlParams {
|
|
33
|
+
$type: 'WebSocketParams'
|
|
34
|
+
startOptions?: WebSocketCallOptions;
|
|
35
|
+
stopOptions?: WebSocketCallOptions;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface WebSocketUrlString {
|
|
39
|
+
url: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface WebSocketConfigOptionsUrl extends WebSocketUrlString {
|
|
43
|
+
$type: 'WebSocketUrl'
|
|
44
|
+
startOptions?: WebSocketCallOptions;
|
|
45
|
+
stopOptions?: WebSocketCallOptions;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface WorkerConfigOptionsParams {
|
|
49
|
+
$type: 'WorkerConfig'
|
|
50
|
+
url: URL;
|
|
51
|
+
type: 'classic' | 'module';
|
|
52
|
+
messagePort?: MessagePort;
|
|
53
|
+
workerName?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface WorkerConfigOptionsDirect {
|
|
57
|
+
$type: 'WorkerDirect';
|
|
58
|
+
worker: Worker;
|
|
59
|
+
messagePort?: MessagePort;
|
|
60
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -3,28 +3,5 @@
|
|
|
3
3
|
* Licensed under the MIT License. See LICENSE in the package root for license information.
|
|
4
4
|
* ------------------------------------------------------------------------------------------ */
|
|
5
5
|
|
|
6
|
-
|
|
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
|
-
}
|
|
6
|
+
export * from './client.js';
|
|
7
|
+
export * from './commonTypes.js';
|
package/src/tools/index.ts
CHANGED
|
@@ -3,42 +3,4 @@
|
|
|
3
3
|
* Licensed under the MIT License. See LICENSE in the package root for license information.
|
|
4
4
|
* ------------------------------------------------------------------------------------------ */
|
|
5
5
|
|
|
6
|
-
export
|
|
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
|
-
}
|
|
6
|
+
export * from './logging.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
import { ConsoleLogger as VSCodeConsoleLogger, ILogger } from '@codingame/monaco-vscode-log-service-override';
|
|
7
|
+
import { LogLevel } from 'vscode/services';
|
|
8
|
+
|
|
9
|
+
export interface Logger extends ILogger {
|
|
10
|
+
createErrorAndLog(message: string, ...params: unknown[]): Error;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class ConsoleLogger extends VSCodeConsoleLogger {
|
|
14
|
+
|
|
15
|
+
constructor(logLevel?: LogLevel, useColors?: boolean) {
|
|
16
|
+
super(logLevel ?? LogLevel.Off, useColors);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
createErrorAndLog(message: string, ...params: unknown[]) {
|
|
20
|
+
if (this.getLevel() >= LogLevel.Error) {
|
|
21
|
+
this.error(message, ...params);
|
|
22
|
+
}
|
|
23
|
+
return new Error(message);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
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 * from './fakeWorker.js';
|
|
7
|
+
export * from './services.js';
|
package/src/vscode/services.ts
CHANGED
|
@@ -5,26 +5,32 @@
|
|
|
5
5
|
|
|
6
6
|
import * as monaco from 'monaco-editor';
|
|
7
7
|
import 'vscode/localExtensionHost';
|
|
8
|
-
import { ILogService, initialize, IWorkbenchConstructionOptions,
|
|
8
|
+
import { ILogService, initialize, IWorkbenchConstructionOptions, StandaloneServices, LogLevel } from 'vscode/services';
|
|
9
9
|
import type { WorkerConfig } from '@codingame/monaco-vscode-extensions-service-override';
|
|
10
10
|
import getExtensionServiceOverride from '@codingame/monaco-vscode-extensions-service-override';
|
|
11
11
|
import getLanguagesServiceOverride from '@codingame/monaco-vscode-languages-service-override';
|
|
12
12
|
import getModelServiceOverride from '@codingame/monaco-vscode-model-service-override';
|
|
13
|
+
import getLogServiceOverride from '@codingame/monaco-vscode-log-service-override';
|
|
13
14
|
import type { LocalizationOptions } from '@codingame/monaco-vscode-localization-service-override';
|
|
15
|
+
import { Logger } from 'monaco-languageclient/tools';
|
|
14
16
|
import { FakeWorker as Worker } from './fakeWorker.js';
|
|
15
|
-
import { Logger } from '../tools/index.js';
|
|
16
17
|
|
|
17
18
|
export interface MonacoEnvironmentEnhanced extends monaco.Environment {
|
|
18
19
|
vscodeInitialising?: boolean;
|
|
19
20
|
vscodeApiInitialised?: boolean;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
export
|
|
23
|
+
export interface InitializeServiceConfig {
|
|
23
24
|
userServices?: monaco.editor.IEditorOverrideServices;
|
|
24
25
|
enableExtHostWorker?: boolean;
|
|
25
|
-
debugLogging?: boolean;
|
|
26
26
|
workspaceConfig?: IWorkbenchConstructionOptions;
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface InitServicesInstructions extends InitializeServiceConfig {
|
|
30
|
+
caller?: string;
|
|
31
|
+
performChecks?: () => boolean;
|
|
32
|
+
logger?: Logger;
|
|
33
|
+
}
|
|
28
34
|
|
|
29
35
|
export const initEnhancedMonacoEnvironment = () => {
|
|
30
36
|
const monWin = (self as Window);
|
|
@@ -45,6 +51,7 @@ export const initEnhancedMonacoEnvironment = () => {
|
|
|
45
51
|
export const supplyRequiredServices = async () => {
|
|
46
52
|
return {
|
|
47
53
|
...getLanguagesServiceOverride(),
|
|
54
|
+
...getLogServiceOverride(),
|
|
48
55
|
...getModelServiceOverride()
|
|
49
56
|
};
|
|
50
57
|
};
|
|
@@ -61,33 +68,18 @@ export const mergeServices = (services: monaco.editor.IEditorOverrideServices, o
|
|
|
61
68
|
}
|
|
62
69
|
};
|
|
63
70
|
|
|
64
|
-
export
|
|
65
|
-
serviceConfig?: InitializeServiceConfig;
|
|
66
|
-
caller?: string;
|
|
67
|
-
performChecks?: () => boolean;
|
|
68
|
-
logger?: Logger;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export const initServices = async (instruction: InitServicesInstruction) => {
|
|
71
|
+
export const initServices = async (instructions: InitServicesInstructions) => {
|
|
72
72
|
const envEnhanced = initEnhancedMonacoEnvironment();
|
|
73
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
|
-
|
|
82
74
|
if (!(envEnhanced.vscodeInitialising ?? false)) {
|
|
83
75
|
if (envEnhanced.vscodeApiInitialised ?? false) {
|
|
84
|
-
|
|
76
|
+
instructions.logger?.debug('Initialization of vscode services can only performed once!');
|
|
85
77
|
} else {
|
|
86
78
|
envEnhanced.vscodeInitialising = true;
|
|
87
|
-
|
|
79
|
+
instructions.logger?.debug(`Initializing vscode services. Caller: ${instructions.caller ?? 'unknown'}`);
|
|
88
80
|
|
|
89
|
-
await importAllServices(
|
|
90
|
-
|
|
81
|
+
await importAllServices(instructions);
|
|
82
|
+
instructions.logger?.debug('Initialization of vscode services completed successfully.');
|
|
91
83
|
|
|
92
84
|
envEnhanced.vscodeApiInitialised = true;
|
|
93
85
|
}
|
|
@@ -105,21 +97,19 @@ export const initServices = async (instruction: InitServicesInstruction) => {
|
|
|
105
97
|
* - languages
|
|
106
98
|
* - model
|
|
107
99
|
*/
|
|
108
|
-
export const importAllServices = async (
|
|
109
|
-
const
|
|
110
|
-
const userServices: monaco.editor.IEditorOverrideServices = lc.userServices ?? {};
|
|
100
|
+
export const importAllServices = async (instructions: InitServicesInstructions) => {
|
|
101
|
+
const userServices: monaco.editor.IEditorOverrideServices = instructions.userServices ?? {};
|
|
111
102
|
|
|
112
103
|
const lcRequiredServices = await supplyRequiredServices();
|
|
113
104
|
|
|
114
105
|
mergeServices(lcRequiredServices, userServices);
|
|
115
|
-
await configureExtHostWorker(
|
|
106
|
+
await configureExtHostWorker(instructions.enableExtHostWorker === true, userServices);
|
|
116
107
|
|
|
117
|
-
reportServiceLoading(userServices,
|
|
108
|
+
reportServiceLoading(userServices, instructions.logger);
|
|
118
109
|
|
|
119
|
-
if (
|
|
120
|
-
await initialize(userServices, undefined,
|
|
121
|
-
|
|
122
|
-
StandaloneServices.get(ILogService).setLevel(logLevel);
|
|
110
|
+
if (instructions.performChecks === undefined || (typeof instructions.performChecks === 'function' && instructions.performChecks())) {
|
|
111
|
+
await initialize(userServices, undefined, instructions.workspaceConfig);
|
|
112
|
+
StandaloneServices.get(ILogService).setLevel(instructions.logger?.getLevel() ?? LogLevel.Off);
|
|
123
113
|
}
|
|
124
114
|
};
|
|
125
115
|
|