monaco-languageclient 8.8.3 → 9.0.0-next.10

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/lib/client.d.ts +13 -0
  3. package/lib/client.d.ts.map +1 -0
  4. package/lib/client.js +16 -0
  5. package/lib/client.js.map +1 -0
  6. package/lib/commonTypes.d.ts +47 -0
  7. package/lib/commonTypes.d.ts.map +1 -0
  8. package/lib/commonTypes.js +6 -0
  9. package/lib/commonTypes.js.map +1 -0
  10. package/lib/fs/definitions.d.ts +98 -0
  11. package/lib/fs/definitions.d.ts.map +1 -0
  12. package/lib/fs/definitions.js +12 -0
  13. package/lib/fs/definitions.js.map +1 -0
  14. package/lib/fs/endpoints/defaultEndpoint.d.ts +17 -0
  15. package/lib/fs/endpoints/defaultEndpoint.d.ts.map +1 -0
  16. package/lib/fs/endpoints/defaultEndpoint.js +45 -0
  17. package/lib/fs/endpoints/defaultEndpoint.js.map +1 -0
  18. package/lib/fs/index.d.ts +3 -0
  19. package/lib/fs/index.d.ts.map +1 -0
  20. package/lib/fs/index.js +7 -0
  21. package/lib/fs/index.js.map +1 -0
  22. package/lib/index.d.ts +2 -15
  23. package/lib/index.d.ts.map +1 -1
  24. package/lib/index.js +2 -11
  25. package/lib/index.js.map +1 -1
  26. package/lib/tools/index.d.ts +2 -14
  27. package/lib/tools/index.d.ts.map +1 -1
  28. package/lib/tools/index.js +2 -27
  29. package/lib/tools/index.js.map +1 -1
  30. package/lib/tools/logging.d.ts +10 -0
  31. package/lib/tools/logging.d.ts.map +1 -0
  32. package/lib/tools/logging.js +18 -0
  33. package/lib/tools/logging.js.map +1 -0
  34. package/lib/tools/utils.d.ts +3 -0
  35. package/lib/tools/utils.d.ts.map +1 -0
  36. package/lib/tools/utils.js +36 -0
  37. package/lib/tools/utils.js.map +1 -0
  38. package/lib/vscode/index.d.ts +3 -0
  39. package/lib/vscode/index.d.ts.map +1 -0
  40. package/lib/vscode/index.js +7 -0
  41. package/lib/vscode/index.js.map +1 -0
  42. package/lib/vscode/services.d.ts +29 -14
  43. package/lib/vscode/services.d.ts.map +1 -1
  44. package/lib/vscode/services.js +39 -31
  45. package/lib/vscode/services.js.map +1 -1
  46. package/package.json +23 -14
  47. package/src/client.ts +26 -0
  48. package/src/commonTypes.ts +60 -0
  49. package/src/fs/definitions.ts +127 -0
  50. package/src/fs/endpoints/defaultEndpoint.ts +60 -0
  51. package/src/fs/index.ts +7 -0
  52. package/src/index.ts +2 -25
  53. package/src/tools/index.ts +2 -39
  54. package/src/tools/logging.ts +26 -0
  55. package/src/tools/utils.ts +39 -0
  56. package/src/vscode/index.ts +7 -0
  57. package/src/vscode/services.ts +68 -44
@@ -1,31 +1,46 @@
1
1
  import * as monaco from 'monaco-editor';
2
2
  import 'vscode/localExtensionHost';
3
3
  import { IWorkbenchConstructionOptions } from 'vscode/services';
4
+ import { OpenEditor } from '@codingame/monaco-vscode-editor-service-override';
4
5
  import type { LocalizationOptions } from '@codingame/monaco-vscode-localization-service-override';
5
- import { Logger } from '../tools/index.js';
6
+ import { EnvironmentOverride } from 'vscode/workbench';
7
+ import { Logger } from 'monaco-languageclient/tools';
6
8
  export interface MonacoEnvironmentEnhanced extends monaco.Environment {
7
9
  vscodeInitialising?: boolean;
8
10
  vscodeApiInitialised?: boolean;
9
11
  }
10
- export type InitializeServiceConfig = {
11
- userServices?: monaco.editor.IEditorOverrideServices;
12
+ export interface UserConfiguration {
13
+ json?: string;
14
+ }
15
+ export interface ViewsConfig {
16
+ viewServiceType: 'EditorService' | 'ViewsService' | 'WorkspaceService';
17
+ openEditorFunc?: OpenEditor;
18
+ viewsInitFunc?: () => void;
19
+ }
20
+ export interface VscodeApiConfig {
21
+ vscodeApiInitPerformExternally?: boolean;
22
+ loadThemes?: boolean;
23
+ serviceOverrides?: monaco.editor.IEditorOverrideServices;
12
24
  enableExtHostWorker?: boolean;
13
- debugLogging?: boolean;
14
25
  workspaceConfig?: IWorkbenchConstructionOptions;
15
- };
26
+ userConfiguration?: UserConfiguration;
27
+ viewsConfig?: ViewsConfig;
28
+ envOptions?: EnvironmentOverride;
29
+ }
30
+ export interface InitServicesInstructions {
31
+ htmlContainer?: HTMLElement;
32
+ caller?: string;
33
+ performServiceConsistencyChecks?: () => boolean;
34
+ logger?: Logger;
35
+ }
16
36
  export declare const initEnhancedMonacoEnvironment: () => MonacoEnvironmentEnhanced;
37
+ export declare const getMonacoEnvironmentEnhanced: () => MonacoEnvironmentEnhanced;
17
38
  export declare const supplyRequiredServices: () => Promise<{
18
39
  [x: string]: any;
19
40
  }>;
20
41
  export declare const reportServiceLoading: (services: monaco.editor.IEditorOverrideServices, logger?: Logger) => void;
21
- export declare const mergeServices: (services: monaco.editor.IEditorOverrideServices, overrideServices: monaco.editor.IEditorOverrideServices) => void;
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>;
42
+ export declare const mergeServices: (overrideServices: monaco.editor.IEditorOverrideServices, services?: monaco.editor.IEditorOverrideServices) => void;
43
+ export declare const initServices: (vscodeApiConfig: VscodeApiConfig, instructions: InitServicesInstructions) => Promise<void>;
29
44
  /**
30
45
  * monaco-vscode-api automatically loads the following services:
31
46
  * - layout
@@ -37,7 +52,7 @@ export declare const initServices: (instruction: InitServicesInstruction) => Pro
37
52
  * - languages
38
53
  * - model
39
54
  */
40
- export declare const importAllServices: (instruction: InitServicesInstruction) => Promise<void>;
55
+ export declare const importAllServices: (vscodeApiConfig: VscodeApiConfig, instructions: InitServicesInstructions) => Promise<void>;
41
56
  /**
42
57
  * Enable ext host to run in a worker
43
58
  */
@@ -1 +1 @@
1
- {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/vscode/services.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe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BAAmB,CAAC;CACpC;AAED,MAAM,WAAW,wBAAwB;IACrC,aAAa,CAAC,EAAE,WAAW,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+BAA+B,CAAC,EAAE,MAAM,OAAO,CAAC;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,6BAA6B,iCAczC,CAAC;AAEF,eAAO,MAAM,4BAA4B,QAEF,yBACtC,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,qBAAsB,MAAM,CAAC,MAAM,CAAC,uBAAuB,aAAa,MAAM,CAAC,MAAM,CAAC,uBAAuB,SAMtI,CAAC;AAEF,eAAO,MAAM,YAAY,oBAA2B,eAAe,gBAAgB,wBAAwB,kBAmB1G,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,oBAA2B,eAAe,gBAAgB,wBAAwB,kBAoB/G,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,wBAA+B,OAAO,gBAAgB,MAAM,CAAC,MAAM,CAAC,uBAAuB,kBAY7H,CAAC;AAEF,eAAO,MAAM,gCAAgC,QAAO,mBA8DnD,CAAC"}
@@ -3,12 +3,14 @@
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, LogLevel, StandaloneServices } from 'vscode/services';
6
+ import { initialize } 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
+ import { setUnexpectedErrorHandler } from 'vscode/monaco';
13
+ import { updateUserConfiguration } from '@codingame/monaco-vscode-configuration-service-override';
12
14
  export const initEnhancedMonacoEnvironment = () => {
13
15
  const monWin = self;
14
16
  if (!monWin.MonacoEnvironment) {
@@ -23,9 +25,14 @@ export const initEnhancedMonacoEnvironment = () => {
23
25
  }
24
26
  return envEnhanced;
25
27
  };
28
+ export const getMonacoEnvironmentEnhanced = () => {
29
+ const monWin = self;
30
+ return monWin.MonacoEnvironment;
31
+ };
26
32
  export const supplyRequiredServices = async () => {
27
33
  return {
28
34
  ...getLanguagesServiceOverride(),
35
+ ...getLogServiceOverride(),
29
36
  ...getModelServiceOverride()
30
37
  };
31
38
  };
@@ -34,31 +41,28 @@ export const reportServiceLoading = (services, logger) => {
34
41
  logger?.debug(`Loading service: ${serviceName}`);
35
42
  }
36
43
  };
37
- export const mergeServices = (services, overrideServices) => {
38
- for (const [name, service] of Object.entries(services)) {
39
- overrideServices[name] = service;
44
+ export const mergeServices = (overrideServices, services) => {
45
+ if (services !== undefined) {
46
+ for (const [name, service] of Object.entries(services)) {
47
+ overrideServices[name] = service;
48
+ }
40
49
  }
41
50
  };
42
- export const initServices = async (instruction) => {
51
+ export const initServices = async (vscodeApiConfig, instructions) => {
43
52
  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
53
  if (!(envEnhanced.vscodeInitialising ?? false)) {
52
54
  if (envEnhanced.vscodeApiInitialised ?? false) {
53
- instruction.logger?.debug('Initialization of vscode services can only performed once!');
55
+ instructions.logger?.debug('Initialization of vscode services can only performed once!');
54
56
  }
55
57
  else {
56
58
  envEnhanced.vscodeInitialising = true;
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.');
59
+ instructions.logger?.debug(`Initializing vscode services. Caller: ${instructions.caller ?? 'unknown'}`);
60
+ await importAllServices(vscodeApiConfig, instructions);
61
+ vscodeApiConfig.viewsConfig?.viewsInitFunc?.();
62
+ instructions.logger?.debug('Initialization of vscode services completed successfully.');
60
63
  envEnhanced.vscodeApiInitialised = true;
61
64
  }
65
+ await updateUserConfiguration(vscodeApiConfig.userConfiguration?.json ?? JSON.stringify({}));
62
66
  }
63
67
  };
64
68
  /**
@@ -72,18 +76,23 @@ export const initServices = async (instruction) => {
72
76
  * - languages
73
77
  * - model
74
78
  */
75
- export const importAllServices = async (instruction) => {
76
- const lc = instruction.serviceConfig ?? {};
77
- const userServices = lc.userServices ?? {};
78
- const lcRequiredServices = await supplyRequiredServices();
79
- mergeServices(lcRequiredServices, userServices);
80
- await configureExtHostWorker(instruction.serviceConfig?.enableExtHostWorker === true, userServices);
81
- reportServiceLoading(userServices, instruction.logger);
82
- if (instruction.performChecks === undefined || instruction.performChecks()) {
83
- await initialize(userServices, undefined, lc.workspaceConfig);
84
- const logLevel = lc.workspaceConfig?.developmentOptions?.logLevel ?? LogLevel.Info;
85
- StandaloneServices.get(ILogService).setLevel(logLevel);
79
+ export const importAllServices = async (vscodeApiConfig, instructions) => {
80
+ const services = await supplyRequiredServices();
81
+ mergeServices(services, vscodeApiConfig.serviceOverrides);
82
+ await configureExtHostWorker(vscodeApiConfig.enableExtHostWorker === true, services);
83
+ reportServiceLoading(services, instructions.logger);
84
+ if (instructions.performServiceConsistencyChecks === undefined ||
85
+ (typeof instructions.performServiceConsistencyChecks === 'function' && instructions.performServiceConsistencyChecks())) {
86
+ if (vscodeApiConfig.viewsConfig?.viewServiceType === 'ViewsService' || vscodeApiConfig.viewsConfig?.viewServiceType === 'WorkspaceService') {
87
+ await initialize(services, instructions.htmlContainer, vscodeApiConfig.workspaceConfig, vscodeApiConfig.envOptions);
88
+ }
89
+ else {
90
+ await initialize(services, undefined, vscodeApiConfig.workspaceConfig, vscodeApiConfig.envOptions);
91
+ }
86
92
  }
93
+ setUnexpectedErrorHandler((e) => {
94
+ instructions.logger?.createErrorAndLog('Unexpected error', e);
95
+ });
87
96
  };
88
97
  /**
89
98
  * Enable ext host to run in a worker
@@ -95,10 +104,9 @@ export const configureExtHostWorker = async (enableExtHostWorker, userServices)
95
104
  url: fakeWorker.url.toString(),
96
105
  options: fakeWorker.options
97
106
  };
98
- const extHostServices = {
107
+ mergeServices(userServices, {
99
108
  ...getExtensionServiceOverride(workerConfig),
100
- };
101
- mergeServices(extHostServices, userServices);
109
+ });
102
110
  }
103
111
  };
104
112
  export const createDefaultLocaleConfiguration = () => {
@@ -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,QAAQ,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEvH,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,iBAAiB,EAAE,CAAC;QAC5B,MAAM,CAAC,iBAAiB,GAAG,EAAE,CAAC;IAClC,CAAC;IACD,MAAM,WAAW,GAAG,MAAM,CAAC,iBAA8C,CAAC;IAC1E,IAAI,WAAW,CAAC,oBAAo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
  "name": "monaco-languageclient",
3
- "version": "8.8.3",
3
+ "version": "9.0.0-next.10",
4
4
  "description": "Monaco Language client implementation",
5
5
  "author": {
6
6
  "name": "TypeFox GmbH",
@@ -29,8 +29,12 @@
29
29
  "default": "./lib/tools/index.js"
30
30
  },
31
31
  "./vscode/services": {
32
- "types": "./lib/vscode/services.d.ts",
33
- "default": "./lib/vscode/services.js"
32
+ "types": "./lib/vscode/index.d.ts",
33
+ "default": "./lib/vscode/index.js"
34
+ },
35
+ "./fs": {
36
+ "types": "./lib/fs/index.d.ts",
37
+ "default": "./lib/fs/index.js"
34
38
  }
35
39
  },
36
40
  "typesVersions": {
@@ -42,7 +46,10 @@
42
46
  "lib/tools/index"
43
47
  ],
44
48
  "vscode/services": [
45
- "lib/vscode/services"
49
+ "lib/vscode/index"
50
+ ],
51
+ "fs": [
52
+ "lib/fs/index"
46
53
  ]
47
54
  }
48
55
  },
@@ -51,8 +58,8 @@
51
58
  "npm": ">=9.0.0"
52
59
  },
53
60
  "volta": {
54
- "node": "20.16.0",
55
- "npm": "10.8.1"
61
+ "node": "22.12.0",
62
+ "npm": "10.9.0"
56
63
  },
57
64
  "files": [
58
65
  "lib",
@@ -62,17 +69,19 @@
62
69
  "LICENSE"
63
70
  ],
64
71
  "dependencies": {
65
- "@codingame/monaco-vscode-extensions-service-override": "~8.0.4",
66
- "@codingame/monaco-vscode-languages-service-override": "~8.0.4",
67
- "@codingame/monaco-vscode-localization-service-override": "~8.0.4",
68
- "@codingame/monaco-vscode-model-service-override": "~8.0.4",
69
- "monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~8.0.4",
70
- "vscode": "npm:@codingame/monaco-vscode-api@~8.0.4",
72
+ "@codingame/monaco-vscode-configuration-service-override": "~11.1.2",
73
+ "@codingame/monaco-vscode-extensions-service-override": "~11.1.2",
74
+ "@codingame/monaco-vscode-languages-service-override": "~11.1.2",
75
+ "@codingame/monaco-vscode-localization-service-override": "~11.1.2",
76
+ "@codingame/monaco-vscode-log-service-override": "~11.1.2",
77
+ "@codingame/monaco-vscode-model-service-override": "~11.1.2",
78
+ "monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~11.1.2",
79
+ "vscode": "npm:@codingame/monaco-vscode-api@~11.1.2",
71
80
  "vscode-languageclient": "~9.0.1"
72
81
  },
73
82
  "peerDependencies": {
74
- "monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~8.0.4",
75
- "vscode": "npm:@codingame/monaco-vscode-api@~8.0.4"
83
+ "monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~11.1.2",
84
+ "vscode": "npm:@codingame/monaco-vscode-api@~11.1.2"
76
85
  },
77
86
  "peerDependenciesMeta": {
78
87
  "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 ConnectionConfigOptions = 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
+ }
@@ -0,0 +1,127 @@
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 { Logger } from 'monaco-languageclient/tools';
7
+
8
+ export interface FileReadRequest {
9
+ resourceUri: string
10
+ }
11
+
12
+ export type FileReadResultStatus = 'success' | 'denied';
13
+
14
+ export interface FileReadRequestResult {
15
+ status: FileReadResultStatus
16
+ content: string | ArrayBuffer
17
+ }
18
+
19
+ export interface FileUpdate {
20
+ resourceUri: string
21
+ content: string | ArrayBuffer
22
+ }
23
+
24
+ export type FileUpdateResultStatus = 'equal' | 'updated' | 'created' | 'denied';
25
+
26
+ export interface FileUpdateResult {
27
+ status: FileUpdateResultStatus
28
+ message?: string
29
+ }
30
+
31
+ export interface DirectoryListingRequest {
32
+ directoryUri: string
33
+ }
34
+
35
+ export interface DirectoryListingRequestResult {
36
+ files: string[]
37
+ }
38
+
39
+ export type StatsRequestType = 'directory' | 'file';
40
+
41
+ export interface StatsRequest {
42
+ type: StatsRequestType,
43
+ resourceUri: string
44
+ }
45
+
46
+ export interface StatsRequestResult {
47
+ type: StatsRequestType
48
+ size: number
49
+ name: string
50
+ mtime: number
51
+ }
52
+
53
+ export enum EndpointType {
54
+ DRIVER,
55
+ FOLLOWER,
56
+ LOCAL,
57
+ EMPTY
58
+ }
59
+
60
+ export interface FileSystemCapabilities {
61
+
62
+ /**
63
+ * Get a text file content
64
+ * @param params the resourceUri of the file
65
+ * @returns The ReadFileResult containing the content of the file
66
+ */
67
+ readFile(params: FileReadRequest): Promise<FileReadRequestResult>
68
+
69
+ /**
70
+ * Save a file on the filesystem
71
+ * @param params the resourceUri and the content of the file
72
+ * @returns The FileUpdateResult containing the result of the operation and an optional message
73
+ */
74
+ writeFile(params: FileUpdate): Promise<FileUpdateResult>;
75
+
76
+ /**
77
+ * The implementation has to decide if the file at given uri at need to be updated
78
+ * @param params the resourceUri and the content of the file
79
+ * @returns The FileUpdateResult containing the result of the operation and an optional message
80
+ */
81
+ syncFile(params: FileUpdate): Promise<FileUpdateResult>;
82
+
83
+ /**
84
+ * Get file stats on a given file
85
+ * @param params the resourceUri and if a file or a directory is requested
86
+ */
87
+ getFileStats(params: StatsRequest): Promise<StatsRequestResult>
88
+
89
+ /**
90
+ * List the files of a directory
91
+ * @param resourceUri the Uri of the directory
92
+ */
93
+ listFiles(params: DirectoryListingRequest): Promise<DirectoryListingRequestResult>
94
+
95
+ }
96
+
97
+ /**
98
+ * Defines the APT for a file system endpoint
99
+ */
100
+ export interface FileSystemEndpoint extends FileSystemCapabilities {
101
+
102
+ /**
103
+ * Whatever can't be handled in the constructor should be done here
104
+ */
105
+ init?(): void;
106
+
107
+ /**
108
+ * Set an optional logger
109
+ * @param logger the logger implemenation
110
+ */
111
+ setLogger?(logger: Logger): void;
112
+
113
+ /**
114
+ * Get the type of the client
115
+ */
116
+ getEndpointType(): EndpointType;
117
+
118
+ /**
119
+ * Provide info about the file system
120
+ */
121
+ getFileSystemInfo(): string;
122
+
123
+ /**
124
+ * Signal readiness
125
+ */
126
+ ready?(): void;
127
+ }
@@ -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 { Logger } from 'monaco-languageclient/tools';
7
+ import { DirectoryListingRequest, DirectoryListingRequestResult, EndpointType, FileReadRequest, FileReadRequestResult, FileSystemEndpoint, FileUpdate, FileUpdateResult, StatsRequest, StatsRequestResult } from '../definitions.js';
8
+
9
+ export class EmptyFileSystemEndpoint implements FileSystemEndpoint {
10
+
11
+ private endpointType: EndpointType;
12
+ private logger?: Logger;
13
+
14
+ constructor(endpointType: EndpointType) {
15
+ this.endpointType = endpointType;
16
+ }
17
+
18
+ init(): void { }
19
+
20
+ getFileSystemInfo(): string {
21
+ return 'This file system performs no operations.';
22
+ }
23
+
24
+ setLogger(logger: Logger): void {
25
+ this.logger = logger;
26
+ }
27
+
28
+ getEndpointType(): EndpointType {
29
+ return this.endpointType;
30
+ }
31
+
32
+ readFile(params: FileReadRequest): Promise<FileReadRequestResult> {
33
+ this.logger?.info(`Reading file: ${params.resourceUri}`);
34
+ return Promise.resolve({
35
+ status: 'denied',
36
+ content: ''
37
+ });
38
+ }
39
+
40
+ writeFile(params: FileUpdate): Promise<FileUpdateResult> {
41
+ this.logger?.info(`Writing file: ${params.resourceUri}`);
42
+ return Promise.resolve({ status: 'denied' });
43
+ }
44
+
45
+ syncFile(params: FileUpdate): Promise<FileUpdateResult> {
46
+ this.logger?.info(`Syncing file: ${params.resourceUri}`);
47
+ return Promise.resolve({ status: 'denied' });
48
+ }
49
+
50
+ getFileStats(params: StatsRequest): Promise<StatsRequestResult> {
51
+ this.logger?.info(`Getting file stats for: "${params.resourceUri}" (${params.type})`);
52
+ return Promise.reject('No stats available.');
53
+ }
54
+
55
+ listFiles(params: DirectoryListingRequest): Promise<DirectoryListingRequestResult> {
56
+ this.logger?.info(`Listing files for directory: "${params.directoryUri}"`);
57
+ return Promise.reject('No file listing possible.');
58
+ }
59
+
60
+ }
@@ -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 './definitions.js';
7
+ export * from './endpoints/defaultEndpoint.js';
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
- 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
- }
6
+ export * from './client.js';
7
+ export * from './commonTypes.js';