diff --git a/index.html b/index.html
index fe4686cde..ec16768eb 100644
--- a/index.html
+++ b/index.html
@@ -74,6 +74,7 @@
Monaco Editor React
monaco-editor related examples
Monaco Editor Wrapper TypeScript Example
+ Files Testbed
Verification
Angular
diff --git a/package-lock.json b/package-lock.json
index fcc01a0dd..c8c4e1ba9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2401,6 +2401,12 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/@socket.io/component-emitter": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz",
+ "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==",
+ "license": "MIT"
+ },
"node_modules/@stylistic/eslint-plugin": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin/-/eslint-plugin-2.9.0.tgz",
@@ -2628,6 +2634,22 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/@types/cors": {
+ "version": "2.8.17",
+ "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.17.tgz",
+ "integrity": "sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
+ "node_modules/@types/emscripten": {
+ "version": "1.39.13",
+ "resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-1.39.13.tgz",
+ "integrity": "sha512-cFq+fO/isvhvmuP/+Sl4K4jtU6E23DoivtbO4r50e3odaxAiVdbfSYRDdJ4gCdxx+3aRjhphS5ZMwIH4hFy/Cw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/estree": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
@@ -2703,7 +2725,6 @@
"version": "20.16.15",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.15.tgz",
"integrity": "sha512-DV58qQz9dBMqVVn+qnKwGa51QzCD4YM/tQM16qLKxdf5tqz5W4QwtrMzjSTbabN1cFTSuyxVYBy+QWHjWW8X/g==",
- "dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.19.2"
@@ -3859,6 +3880,15 @@
],
"license": "MIT"
},
+ "node_modules/base64id": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
+ "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==",
+ "license": "MIT",
+ "engines": {
+ "node": "^4.5.0 || >= 5.9"
+ }
+ },
"node_modules/basic-auth": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
@@ -4403,6 +4433,19 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/cors": {
+ "version": "2.8.5",
+ "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
+ "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
+ "license": "MIT",
+ "dependencies": {
+ "object-assign": "^4",
+ "vary": "^1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
"node_modules/corser": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz",
@@ -4587,7 +4630,6 @@
"version": "4.3.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
"integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
- "dev": true,
"license": "MIT",
"dependencies": {
"ms": "^2.1.3"
@@ -5038,6 +5080,106 @@
"once": "^1.4.0"
}
},
+ "node_modules/engine.io": {
+ "version": "6.6.2",
+ "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.6.2.tgz",
+ "integrity": "sha512-gmNvsYi9C8iErnZdVcJnvCpSKbWTt1E8+JZo8b+daLninywUWi5NQ5STSHZ9rFjFO7imNcvb8Pc5pe/wMR5xEw==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/cookie": "^0.4.1",
+ "@types/cors": "^2.8.12",
+ "@types/node": ">=10.0.0",
+ "accepts": "~1.3.4",
+ "base64id": "2.0.0",
+ "cookie": "~0.7.2",
+ "cors": "~2.8.5",
+ "debug": "~4.3.1",
+ "engine.io-parser": "~5.2.1",
+ "ws": "~8.17.1"
+ },
+ "engines": {
+ "node": ">=10.2.0"
+ }
+ },
+ "node_modules/engine.io-client": {
+ "version": "6.6.2",
+ "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.6.2.tgz",
+ "integrity": "sha512-TAr+NKeoVTjEVW8P3iHguO1LO6RlUz9O5Y8o7EY0fU+gY1NYqas7NN3slpFtbXEsLMHk0h90fJMfKjRkQ0qUIw==",
+ "license": "MIT",
+ "dependencies": {
+ "@socket.io/component-emitter": "~3.1.0",
+ "debug": "~4.3.1",
+ "engine.io-parser": "~5.2.1",
+ "ws": "~8.17.1",
+ "xmlhttprequest-ssl": "~2.1.1"
+ }
+ },
+ "node_modules/engine.io-client/node_modules/ws": {
+ "version": "8.17.1",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
+ "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": ">=5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/engine.io-parser": {
+ "version": "5.2.3",
+ "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.3.tgz",
+ "integrity": "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
+ "node_modules/engine.io/node_modules/@types/cookie": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
+ "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==",
+ "license": "MIT"
+ },
+ "node_modules/engine.io/node_modules/cookie": {
+ "version": "0.7.2",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
+ "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/engine.io/node_modules/ws": {
+ "version": "8.17.1",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
+ "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": ">=5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
+ }
+ },
"node_modules/entities": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
@@ -8079,6 +8221,15 @@
"url": "https://github.com/fb55/nth-check?sponsor=1"
}
},
+ "node_modules/object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/object-inspect": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz",
@@ -9406,6 +9557,83 @@
"npm": ">= 3.0.0"
}
},
+ "node_modules/socket.io": {
+ "version": "4.8.0",
+ "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.8.0.tgz",
+ "integrity": "sha512-8U6BEgGjQOfGz3HHTYaC/L1GaxDCJ/KM0XTkJly0EhZ5U/du9uNEZy4ZgYzEzIqlx2CMm25CrCqr1ck899eLNA==",
+ "license": "MIT",
+ "dependencies": {
+ "accepts": "~1.3.4",
+ "base64id": "~2.0.0",
+ "cors": "~2.8.5",
+ "debug": "~4.3.2",
+ "engine.io": "~6.6.0",
+ "socket.io-adapter": "~2.5.2",
+ "socket.io-parser": "~4.2.4"
+ },
+ "engines": {
+ "node": ">=10.2.0"
+ }
+ },
+ "node_modules/socket.io-adapter": {
+ "version": "2.5.5",
+ "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.5.tgz",
+ "integrity": "sha512-eLDQas5dzPgOWCk9GuuJC2lBqItuhKI4uxGgo9aIV7MYbk2h9Q6uULEh8WBzThoI7l+qU9Ast9fVUmkqPP9wYg==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "~4.3.4",
+ "ws": "~8.17.1"
+ }
+ },
+ "node_modules/socket.io-adapter/node_modules/ws": {
+ "version": "8.17.1",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
+ "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": ">=5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/socket.io-client": {
+ "version": "4.8.0",
+ "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.8.0.tgz",
+ "integrity": "sha512-C0jdhD5yQahMws9alf/yvtsMGTaIDBnZ8Rb5HU56svyq0l5LIrGzIDZZD5pHQlmzxLuU91Gz+VpQMKgCTNYtkw==",
+ "license": "MIT",
+ "dependencies": {
+ "@socket.io/component-emitter": "~3.1.0",
+ "debug": "~4.3.2",
+ "engine.io-client": "~6.6.1",
+ "socket.io-parser": "~4.2.4"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
+ "node_modules/socket.io-parser": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz",
+ "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==",
+ "license": "MIT",
+ "dependencies": {
+ "@socket.io/component-emitter": "~3.1.0",
+ "debug": "~4.3.1"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
"node_modules/socks": {
"version": "2.8.3",
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz",
@@ -10238,7 +10466,6 @@
"version": "6.19.8",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
- "dev": true,
"license": "MIT"
},
"node_modules/union": {
@@ -11434,6 +11661,20 @@
}
}
},
+ "node_modules/wtd-core": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/wtd-core/-/wtd-core-4.0.1.tgz",
+ "integrity": "sha512-q6sV6Slw47bwlhwbztot0MklWaVzywUAi0wAKWwOuL/LTY4IpVFgoHQ+cnlhG2ZUms/OkJUhyfhsfoHNYkKjzA==",
+ "license": "MIT"
+ },
+ "node_modules/xmlhttprequest-ssl": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.1.1.tgz",
+ "integrity": "sha512-ptjR8YSJIXoA3Mbv5po7RtSYHO6mZr8s7i5VGmEk7QY2pQWyT1o0N+W1gKbOyJPUCGXGnuw0wqe8f0L6Y0ny7g==",
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
"node_modules/y18n": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
@@ -11642,15 +11883,19 @@
"react": "~18.3.1",
"react-dom": "~18.3.1",
"request-light": "~0.8.0",
+ "socket.io": "~4.8.0",
+ "socket.io-client": "~4.8.0",
"vscode": "npm:@codingame/monaco-vscode-api@~10.1.1",
"vscode-json-languageservice": "~5.4.1",
"vscode-languageclient": "~9.0.1",
"vscode-languageserver": "~9.0.1",
"vscode-uri": "~3.0.8",
"vscode-ws-jsonrpc": "~3.3.2",
- "ws": "~8.18.0"
+ "ws": "~8.18.0",
+ "wtd-core": "~4.0.1"
},
"devDependencies": {
+ "@types/emscripten": "~1.39.13",
"@types/express": "~5.0.0",
"@types/ws": "~8.5.12",
"langium-cli": "~3.2.0",
diff --git a/packages/client/package.json b/packages/client/package.json
index d6d2b1507..ac55bb6d5 100644
--- a/packages/client/package.json
+++ b/packages/client/package.json
@@ -31,6 +31,10 @@
"./vscode/services": {
"types": "./lib/vscode/index.d.ts",
"default": "./lib/vscode/index.js"
+ },
+ "./fs": {
+ "types": "./lib/fs/index.d.ts",
+ "default": "./lib/fs/index.js"
}
},
"typesVersions": {
@@ -43,6 +47,9 @@
],
"vscode/services": [
"lib/vscode/index"
+ ],
+ "fs": [
+ "lib/fs/index"
]
}
},
diff --git a/packages/client/src/fs/definitions.ts b/packages/client/src/fs/definitions.ts
new file mode 100644
index 000000000..a06a438f0
--- /dev/null
+++ b/packages/client/src/fs/definitions.ts
@@ -0,0 +1,127 @@
+/* --------------------------------------------------------------------------------------------
+ * Copyright (c) 2024 TypeFox and others.
+ * Licensed under the MIT License. See LICENSE in the package root for license information.
+ * ------------------------------------------------------------------------------------------ */
+
+import { Logger } from 'monaco-languageclient/tools';
+
+export interface FileReadRequest {
+ resourceUri: string
+}
+
+export type FileReadResultStatus = 'success' | 'denied';
+
+export interface FileReadRequestResult {
+ status: FileReadResultStatus
+ content: string | ArrayBuffer
+}
+
+export interface FileUpdate {
+ resourceUri: string
+ content: string | ArrayBuffer
+}
+
+export type FileUpdateResultStatus = 'equal' | 'updated' | 'created' | 'denied';
+
+export interface FileUpdateResult {
+ status: FileUpdateResultStatus
+ message?: string
+}
+
+export interface DirectoryListingRequest {
+ directoryUri: string
+}
+
+export interface DirectoryListingRequestResult {
+ files: string[]
+}
+
+export type StatsRequestType = 'directory' | 'file';
+
+export interface StatsRequest {
+ type: StatsRequestType,
+ resourceUri: string
+}
+
+export interface StatsRequestResult {
+ type: StatsRequestType
+ size: number
+ name: string
+ mtime: number
+}
+
+export enum EndpointType {
+ DRIVER,
+ FOLLOWER,
+ LOCAL,
+ EMPTY
+}
+
+export interface FileSystemCapabilities {
+
+ /**
+ * Get a text file content
+ * @param params the resourceUri of the file
+ * @returns The ReadFileResult containing the content of the file
+ */
+ readFile(params: FileReadRequest): Promise
+
+ /**
+ * Save a file on the filesystem
+ * @param params the resourceUri and the content of the file
+ * @returns The FileUpdateResult containing the result of the operation and an optional message
+ */
+ writeFile(params: FileUpdate): Promise;
+
+ /**
+ * The implementation has to decide if the file at given uri at need to be updated
+ * @param params the resourceUri and the content of the file
+ * @returns The FileUpdateResult containing the result of the operation and an optional message
+ */
+ syncFile(params: FileUpdate): Promise;
+
+ /**
+ * Get file stats on a given file
+ * @param params the resourceUri and if a file or a directory is requested
+ */
+ getFileStats(params: StatsRequest): Promise
+
+ /**
+ * List the files of a directory
+ * @param resourceUri the Uri of the directory
+ */
+ listFiles(params: DirectoryListingRequest): Promise
+
+}
+
+/**
+ * Defines the APT for a file system endpoint
+ */
+export interface FileSystemEndpoint extends FileSystemCapabilities {
+
+ /**
+ * Whatever can't be handled in the constructor should be done here
+ */
+ init?(): void;
+
+ /**
+ * Set an optional logger
+ * @param logger the logger implemenation
+ */
+ setLogger?(logger: Logger): void;
+
+ /**
+ * Get the type of the client
+ */
+ getEndpointType(): EndpointType;
+
+ /**
+ * Provide info about the file system
+ */
+ getFileSystemInfo(): string;
+
+ /**
+ * Signal readiness
+ */
+ ready?(): void;
+}
diff --git a/packages/client/src/fs/endpoints/defaultEndpoint.ts b/packages/client/src/fs/endpoints/defaultEndpoint.ts
new file mode 100644
index 000000000..824424d18
--- /dev/null
+++ b/packages/client/src/fs/endpoints/defaultEndpoint.ts
@@ -0,0 +1,60 @@
+/* --------------------------------------------------------------------------------------------
+ * Copyright (c) 2024 TypeFox and others.
+ * Licensed under the MIT License. See LICENSE in the package root for license information.
+ * ------------------------------------------------------------------------------------------ */
+
+import { Logger } from 'monaco-languageclient/tools';
+import { DirectoryListingRequest, DirectoryListingRequestResult, EndpointType, FileReadRequest, FileReadRequestResult, FileSystemEndpoint, FileUpdate, FileUpdateResult, StatsRequest, StatsRequestResult } from '../definitions.js';
+
+export class EmptyFileSystemEndpoint implements FileSystemEndpoint {
+
+ private endpointType: EndpointType;
+ private logger?: Logger;
+
+ constructor(endpointType: EndpointType) {
+ this.endpointType = endpointType;
+ }
+
+ init(): void { }
+
+ getFileSystemInfo(): string {
+ return 'This file system performs no operations.';
+ }
+
+ setLogger(logger: Logger): void {
+ this.logger = logger;
+ }
+
+ getEndpointType(): EndpointType {
+ return this.endpointType;
+ }
+
+ readFile(params: FileReadRequest): Promise {
+ this.logger?.info(`Reading file: ${params.resourceUri}`);
+ return Promise.resolve({
+ status: 'denied',
+ content: ''
+ });
+ }
+
+ writeFile(params: FileUpdate): Promise {
+ this.logger?.info(`Writing file: ${params.resourceUri}`);
+ return Promise.resolve({ status: 'denied' });
+ }
+
+ syncFile(params: FileUpdate): Promise {
+ this.logger?.info(`Syncing file: ${params.resourceUri}`);
+ return Promise.resolve({ status: 'denied' });
+ }
+
+ getFileStats(params: StatsRequest): Promise {
+ this.logger?.info(`Getting file stats for: "${params.resourceUri}" (${params.type})`);
+ return Promise.reject('No stats available.');
+ }
+
+ listFiles(params: DirectoryListingRequest): Promise {
+ this.logger?.info(`Listing files for directory: "${params.directoryUri}"`);
+ return Promise.reject('No file listing possible.');
+ }
+
+}
diff --git a/packages/client/src/fs/index.ts b/packages/client/src/fs/index.ts
new file mode 100644
index 000000000..c3b77aca2
--- /dev/null
+++ b/packages/client/src/fs/index.ts
@@ -0,0 +1,7 @@
+/* --------------------------------------------------------------------------------------------
+ * Copyright (c) 2024 TypeFox and others.
+ * Licensed under the MIT License. See LICENSE in the package root for license information.
+ * ------------------------------------------------------------------------------------------ */
+
+export * from './definitions.js';
+export * from './endpoints/defaultEndpoint.js';
diff --git a/packages/client/test/fs/endpoints/emptyEndpoint.test.ts b/packages/client/test/fs/endpoints/emptyEndpoint.test.ts
new file mode 100644
index 000000000..6696de470
--- /dev/null
+++ b/packages/client/test/fs/endpoints/emptyEndpoint.test.ts
@@ -0,0 +1,58 @@
+/* --------------------------------------------------------------------------------------------
+ * Copyright (c) 2024 TypeFox and others.
+ * Licensed under the MIT License. See LICENSE in the package root for license information.
+ * ------------------------------------------------------------------------------------------ */
+
+import { describe, expect, test } from 'vitest';
+import { EmptyFileSystemEndpoint, EndpointType } from 'monaco-languageclient/fs';
+
+describe('EmptyFileSystemEndpoint Tests', () => {
+
+ const endpoint = new EmptyFileSystemEndpoint(EndpointType.EMPTY);
+
+ test('readFile', async () => {
+ const result = await endpoint.readFile({ resourceUri: '/tmp/test.js' });
+ expect(result).toEqual({
+ status: 'denied',
+ content: ''
+ });
+ });
+
+ test('writeFile', async () => {
+ const result = await endpoint.writeFile({
+ resourceUri: '/tmp/test.js',
+ content: 'console.log("Hello World!");'
+ });
+ expect(result).toEqual({
+ status: 'denied'
+ });
+ });
+
+ test('syncFile', async () => {
+ const result = await endpoint.syncFile({
+ resourceUri: '/tmp/test.js',
+ content: 'console.log("Hello World!");'
+ });
+ expect(result).toEqual({
+ status: 'denied'
+ });
+ });
+
+ test('getFileStats', async () => {
+ expect(async () => {
+ await endpoint.getFileStats({
+ type: 'file',
+ resourceUri: '/tmp/test.js'
+ });
+ }).rejects.toThrowError('No stats available.');
+ });
+
+ test('listFiles', async () => {
+ expect(async () => {
+ await endpoint.listFiles({
+ directoryUri: '/tmp'
+ });
+ }).rejects.toThrowError('No file listing possible.');
+ });
+
+});
diff --git a/packages/examples/clangd.html b/packages/examples/clangd.html
index 905bc23a9..c17461c64 100644
--- a/packages/examples/clangd.html
+++ b/packages/examples/clangd.html
@@ -12,8 +12,10 @@
Cpp Language Client & Clangd Language Server (Worker/Wasm)
This example has been derived from: clangd-in-browser
-
+
+
+