WIP worker-based LSP server instead of mirror model

This commit is contained in:
Henning Dieterichs 2025-12-19 17:09:05 +01:00
parent ec78a33c7b
commit 39e9e78254
No known key found for this signature in database
GPG key ID: 771381EFFDB9EC06
8 changed files with 15895 additions and 192 deletions

View file

@ -1,5 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
/**
* Utility class for writing formatted code with proper indentation
@ -183,15 +185,15 @@ type Type =
interface BaseType {
kind: 'base';
name:
| 'URI'
| 'DocumentUri'
| 'integer'
| 'uinteger'
| 'decimal'
| 'RegExp'
| 'string'
| 'boolean'
| 'null';
| 'URI'
| 'DocumentUri'
| 'integer'
| 'uinteger'
| 'decimal'
| 'RegExp'
| 'string'
| 'boolean'
| 'null';
}
interface ReferenceType {
@ -259,12 +261,16 @@ interface BooleanLiteralType {
class LSPTypesGenerator {
private writer = new LineWriter();
constructor(
private readonly metaModelPath: string,
private readonly outPath: string
) { }
/**
* Load and parse the metaModel.json file
*/
private loadMetaModel(): MetaModel {
const metaModelPath = path.join(__dirname, '..', 'metaModel.json');
const content = fs.readFileSync(metaModelPath, 'utf-8');
const content = fs.readFileSync(this.metaModelPath, 'utf-8');
return JSON.parse(content) as MetaModel;
}
@ -561,7 +567,7 @@ class LSPTypesGenerator {
// Server requests (sent from client to server)
for (const request of metaModel.requests) {
if (request.messageDirection === 'clientToServer' || request.messageDirection === 'both') {
generateRequest(request);
generateRequest(request, true);
}
}
@ -670,18 +676,34 @@ class LSPTypesGenerator {
this.generateApiContract(metaModel);
// Write types file
const srcDir = path.join(__dirname, '..', 'src');
if (!fs.existsSync(srcDir)) {
fs.mkdirSync(srcDir, { recursive: true });
const outDir = path.dirname(this.outPath);
if (!fs.existsSync(outDir)) {
fs.mkdirSync(outDir, { recursive: true });
}
fs.writeFileSync(path.join(srcDir, 'types.ts'), this.writer.toString());
fs.writeFileSync(this.outPath, this.writer.toString());
console.log('Generated LSP types file: src/types.ts');
console.log(`Generated LSP types file: ${this.outPath}`);
}
}
// Run the generator
if (require.main === module) {
const generator = new LSPTypesGenerator();
const argv = yargs(hideBin(process.argv))
.option('input', {
alias: 'i',
type: 'string',
description: 'Path to metaModel.json',
default: path.join(__dirname, '..', 'spec', 'metaModel.json')
})
.option('output', {
alias: 'o',
type: 'string',
description: 'Output file',
default: path.join(__dirname, '..', 'src', 'types.ts')
})
.help()
.parseSync();
const generator = new LSPTypesGenerator(argv.input, argv.output);
generator.generate();
}

View file

@ -13,9 +13,12 @@
"@hediet/json-rpc-websocket": "^0.5.1"
},
"devDependencies": {
"@types/yargs": "^17.0.35",
"rolldown": "^1.0.0-beta.41",
"rolldown-plugin-dts": "^0.16.11",
"rollup-plugin-delete": "^3.0.1"
"rollup-plugin-delete": "^3.0.1",
"tsx": "^4.21.0",
"yargs": "^18.0.0"
},
"peerDependencies": {
"monaco-editor-core": "^0.54.0-dev-20250929"
@ -143,6 +146,448 @@
"tslib": "^2.4.0"
}
},
"node_modules/@esbuild/aix-ppc64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.2.tgz",
"integrity": "sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"aix"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/android-arm": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.2.tgz",
"integrity": "sha512-DVNI8jlPa7Ujbr1yjU2PfUSRtAUZPG9I1RwW4F4xFB1Imiu2on0ADiI/c3td+KmDtVKNbi+nffGDQMfcIMkwIA==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/android-arm64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.2.tgz",
"integrity": "sha512-pvz8ZZ7ot/RBphf8fv60ljmaoydPU12VuXHImtAs0XhLLw+EXBi2BLe3OYSBslR4rryHvweW5gmkKFwTiFy6KA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/android-x64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.2.tgz",
"integrity": "sha512-z8Ank4Byh4TJJOh4wpz8g2vDy75zFL0TlZlkUkEwYXuPSgX8yzep596n6mT7905kA9uHZsf/o2OJZubl2l3M7A==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/darwin-arm64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.2.tgz",
"integrity": "sha512-davCD2Zc80nzDVRwXTcQP/28fiJbcOwvdolL0sOiOsbwBa72kegmVU0Wrh1MYrbuCL98Omp5dVhQFWRKR2ZAlg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/darwin-x64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.2.tgz",
"integrity": "sha512-ZxtijOmlQCBWGwbVmwOF/UCzuGIbUkqB1faQRf5akQmxRJ1ujusWsb3CVfk/9iZKr2L5SMU5wPBi1UWbvL+VQA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/freebsd-arm64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.2.tgz",
"integrity": "sha512-lS/9CN+rgqQ9czogxlMcBMGd+l8Q3Nj1MFQwBZJyoEKI50XGxwuzznYdwcav6lpOGv5BqaZXqvBSiB/kJ5op+g==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/freebsd-x64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.2.tgz",
"integrity": "sha512-tAfqtNYb4YgPnJlEFu4c212HYjQWSO/w/h/lQaBK7RbwGIkBOuNKQI9tqWzx7Wtp7bTPaGC6MJvWI608P3wXYA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-arm": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.2.tgz",
"integrity": "sha512-vWfq4GaIMP9AIe4yj1ZUW18RDhx6EPQKjwe7n8BbIecFtCQG4CfHGaHuh7fdfq+y3LIA2vGS/o9ZBGVxIDi9hw==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-arm64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.2.tgz",
"integrity": "sha512-hYxN8pr66NsCCiRFkHUAsxylNOcAQaxSSkHMMjcpx0si13t1LHFphxJZUiGwojB1a/Hd5OiPIqDdXONia6bhTw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-ia32": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.2.tgz",
"integrity": "sha512-MJt5BRRSScPDwG2hLelYhAAKh9imjHK5+NE/tvnRLbIqUWa+0E9N4WNMjmp/kXXPHZGqPLxggwVhz7QP8CTR8w==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-loong64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.2.tgz",
"integrity": "sha512-lugyF1atnAT463aO6KPshVCJK5NgRnU4yb3FUumyVz+cGvZbontBgzeGFO1nF+dPueHD367a2ZXe1NtUkAjOtg==",
"cpu": [
"loong64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-mips64el": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.2.tgz",
"integrity": "sha512-nlP2I6ArEBewvJ2gjrrkESEZkB5mIoaTswuqNFRv/WYd+ATtUpe9Y09RnJvgvdag7he0OWgEZWhviS1OTOKixw==",
"cpu": [
"mips64el"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-ppc64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.2.tgz",
"integrity": "sha512-C92gnpey7tUQONqg1n6dKVbx3vphKtTHJaNG2Ok9lGwbZil6DrfyecMsp9CrmXGQJmZ7iiVXvvZH6Ml5hL6XdQ==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-riscv64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.2.tgz",
"integrity": "sha512-B5BOmojNtUyN8AXlK0QJyvjEZkWwy/FKvakkTDCziX95AowLZKR6aCDhG7LeF7uMCXEJqwa8Bejz5LTPYm8AvA==",
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-s390x": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.2.tgz",
"integrity": "sha512-p4bm9+wsPwup5Z8f4EpfN63qNagQ47Ua2znaqGH6bqLlmJ4bx97Y9JdqxgGZ6Y8xVTixUnEkoKSHcpRlDnNr5w==",
"cpu": [
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-x64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.2.tgz",
"integrity": "sha512-uwp2Tip5aPmH+NRUwTcfLb+W32WXjpFejTIOWZFw/v7/KnpCDKG66u4DLcurQpiYTiYwQ9B7KOeMJvLCu/OvbA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/netbsd-arm64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.2.tgz",
"integrity": "sha512-Kj6DiBlwXrPsCRDeRvGAUb/LNrBASrfqAIok+xB0LxK8CHqxZ037viF13ugfsIpePH93mX7xfJp97cyDuTZ3cw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/netbsd-x64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.2.tgz",
"integrity": "sha512-HwGDZ0VLVBY3Y+Nw0JexZy9o/nUAWq9MlV7cahpaXKW6TOzfVno3y3/M8Ga8u8Yr7GldLOov27xiCnqRZf0tCA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/openbsd-arm64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.2.tgz",
"integrity": "sha512-DNIHH2BPQ5551A7oSHD0CKbwIA/Ox7+78/AWkbS5QoRzaqlev2uFayfSxq68EkonB+IKjiuxBFoV8ESJy8bOHA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/openbsd-x64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.2.tgz",
"integrity": "sha512-/it7w9Nb7+0KFIzjalNJVR5bOzA9Vay+yIPLVHfIQYG/j+j9VTH84aNB8ExGKPU4AzfaEvN9/V4HV+F+vo8OEg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/openharmony-arm64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.2.tgz",
"integrity": "sha512-LRBbCmiU51IXfeXk59csuX/aSaToeG7w48nMwA6049Y4J4+VbWALAuXcs+qcD04rHDuSCSRKdmY63sruDS5qag==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openharmony"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/sunos-x64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.2.tgz",
"integrity": "sha512-kMtx1yqJHTmqaqHPAzKCAkDaKsffmXkPHThSfRwZGyuqyIeBvf08KSsYXl+abf5HDAPMJIPnbBfXvP2ZC2TfHg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"sunos"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/win32-arm64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.2.tgz",
"integrity": "sha512-Yaf78O/B3Kkh+nKABUF++bvJv5Ijoy9AN1ww904rOXZFLWVc5OLOfL56W+C8F9xn5JQZa3UX6m+IktJnIb1Jjg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/win32-ia32": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.2.tgz",
"integrity": "sha512-Iuws0kxo4yusk7sw70Xa2E2imZU5HoixzxfGCdxwBdhiDgt9vX9VUCBhqcwY7/uh//78A1hMkkROMJq9l27oLQ==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/win32-x64": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.2.tgz",
"integrity": "sha512-sRdU18mcKf7F+YgheI/zGf5alZatMUTKj/jNS6l744f9u3WFu4v7twcUI9vu4mknF4Y9aDlblIie0IM+5xxaqQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@hediet/json-rpc": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/@hediet/json-rpc/-/json-rpc-0.5.0.tgz",
@ -894,6 +1339,49 @@
"@types/node": "*"
}
},
"node_modules/@types/yargs": {
"version": "17.0.35",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.35.tgz",
"integrity": "sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/yargs-parser": "*"
}
},
"node_modules/@types/yargs-parser": {
"version": "21.0.3",
"resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz",
"integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==",
"dev": true,
"license": "MIT"
},
"node_modules/ansi-regex": {
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
"integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/ansi-regex?sponsor=1"
}
},
"node_modules/ansi-styles": {
"version": "6.2.3",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
"integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/ansis": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/ansis/-/ansis-4.2.0.tgz",
@ -944,6 +1432,21 @@
"node": ">=8"
}
},
"node_modules/cliui": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-9.0.1.tgz",
"integrity": "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==",
"dev": true,
"license": "ISC",
"dependencies": {
"string-width": "^7.2.0",
"strip-ansi": "^7.1.0",
"wrap-ansi": "^9.0.0"
},
"engines": {
"node": ">=20"
}
},
"node_modules/debug": {
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
@ -1010,6 +1513,65 @@
}
}
},
"node_modules/emoji-regex": {
"version": "10.6.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz",
"integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==",
"dev": true,
"license": "MIT"
},
"node_modules/esbuild": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.2.tgz",
"integrity": "sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"bin": {
"esbuild": "bin/esbuild"
},
"engines": {
"node": ">=18"
},
"optionalDependencies": {
"@esbuild/aix-ppc64": "0.27.2",
"@esbuild/android-arm": "0.27.2",
"@esbuild/android-arm64": "0.27.2",
"@esbuild/android-x64": "0.27.2",
"@esbuild/darwin-arm64": "0.27.2",
"@esbuild/darwin-x64": "0.27.2",
"@esbuild/freebsd-arm64": "0.27.2",
"@esbuild/freebsd-x64": "0.27.2",
"@esbuild/linux-arm": "0.27.2",
"@esbuild/linux-arm64": "0.27.2",
"@esbuild/linux-ia32": "0.27.2",
"@esbuild/linux-loong64": "0.27.2",
"@esbuild/linux-mips64el": "0.27.2",
"@esbuild/linux-ppc64": "0.27.2",
"@esbuild/linux-riscv64": "0.27.2",
"@esbuild/linux-s390x": "0.27.2",
"@esbuild/linux-x64": "0.27.2",
"@esbuild/netbsd-arm64": "0.27.2",
"@esbuild/netbsd-x64": "0.27.2",
"@esbuild/openbsd-arm64": "0.27.2",
"@esbuild/openbsd-x64": "0.27.2",
"@esbuild/openharmony-arm64": "0.27.2",
"@esbuild/sunos-x64": "0.27.2",
"@esbuild/win32-arm64": "0.27.2",
"@esbuild/win32-ia32": "0.27.2",
"@esbuild/win32-x64": "0.27.2"
}
},
"node_modules/escalade": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/fast-glob": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz",
@ -1061,11 +1623,33 @@
"os": [
"darwin"
],
"peer": true,
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/get-caller-file": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"dev": true,
"license": "ISC",
"engines": {
"node": "6.* || 8.* || >= 10.*"
}
},
"node_modules/get-east-asian-width": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.4.0.tgz",
"integrity": "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/get-tsconfig": {
"version": "4.11.0",
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.11.0.tgz",
@ -1541,6 +2125,40 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/string-width": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
"integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"emoji-regex": "^10.3.0",
"get-east-asian-width": "^1.0.0",
"strip-ansi": "^7.1.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/strip-ansi": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz",
"integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-regex": "^6.0.1"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
}
},
"node_modules/to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
@ -1562,6 +2180,26 @@
"license": "0BSD",
"optional": true
},
"node_modules/tsx": {
"version": "4.21.0",
"resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz",
"integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==",
"dev": true,
"license": "MIT",
"dependencies": {
"esbuild": "~0.27.0",
"get-tsconfig": "^4.7.5"
},
"bin": {
"tsx": "dist/cli.mjs"
},
"engines": {
"node": ">=18.0.0"
},
"optionalDependencies": {
"fsevents": "~2.3.3"
}
},
"node_modules/undici-types": {
"version": "7.16.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
@ -1581,6 +2219,24 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/wrap-ansi": {
"version": "9.0.2",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz",
"integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-styles": "^6.2.1",
"string-width": "^7.0.0",
"strip-ansi": "^7.1.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
}
},
"node_modules/ws": {
"version": "8.18.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz",
@ -1602,6 +2258,44 @@
"optional": true
}
}
},
"node_modules/y18n": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
"dev": true,
"license": "ISC",
"engines": {
"node": ">=10"
}
},
"node_modules/yargs": {
"version": "18.0.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-18.0.0.tgz",
"integrity": "sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==",
"dev": true,
"license": "MIT",
"dependencies": {
"cliui": "^9.0.1",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"string-width": "^7.2.0",
"y18n": "^5.0.5",
"yargs-parser": "^22.0.0"
},
"engines": {
"node": "^20.19.0 || ^22.12.0 || >=23"
}
},
"node_modules/yargs-parser": {
"version": "22.0.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz",
"integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==",
"dev": true,
"license": "ISC",
"engines": {
"node": "^20.19.0 || ^22.12.0 || >=23"
}
}
}
}

View file

@ -14,9 +14,12 @@
"monaco-editor-core": "^0.54.0-dev-20250929"
},
"devDependencies": {
"@types/yargs": "^17.0.35",
"rolldown": "^1.0.0-beta.41",
"rolldown-plugin-dts": "^0.16.11",
"rollup-plugin-delete": "^3.0.1"
"rollup-plugin-delete": "^3.0.1",
"tsx": "^4.21.0",
"yargs": "^18.0.0"
},
"scripts": {
"build": "npx rolldown -c rolldown.config.mjs",

File diff suppressed because it is too large Load diff

View file

@ -31,7 +31,6 @@ export class LspDiagnosticsFeature extends Disposable {
}
}));
debugger;
this._register(this._connection.connection.registerNotificationHandler(
api.client.textDocumentPublishDiagnostics,
(params) => this._handlePublishDiagnostics(params)

View file

@ -3,8 +3,10 @@
// This file is auto-generated. Do not edit manually.
import {
contract, unverifiedRequest,
unverifiedNotification
contract,
Contract,
unverifiedRequest,
unverifiedNotification,
} from "@hediet/json-rpc";
/**
@ -2100,9 +2102,9 @@ export interface InitializeResult {
* @since 3.15.0
*/
serverInfo?: {
name: string;
version?: string
};
name: string;
version?: string
};
}
/**
@ -2534,15 +2536,15 @@ export interface CompletionList {
* @since 3.17.0
*/
itemDefaults?: {
commitCharacters?: (string)[];
editRange?: Range | {
insert: Range;
replace: Range
};
insertTextFormat?: InsertTextFormat;
insertTextMode?: InsertTextMode;
data?: LSPAny
};
commitCharacters?: (string)[];
editRange?: Range | {
insert: Range;
replace: Range
};
insertTextFormat?: InsertTextFormat;
insertTextMode?: InsertTextMode;
data?: LSPAny
};
/**
* The completion items.
*/
@ -2867,8 +2869,8 @@ export interface CodeAction {
* @since 3.16.0
*/
disabled?: {
reason: string
};
reason: string
};
/**
* The workspace edit this code action performs.
*/
@ -2921,8 +2923,8 @@ export interface WorkspaceSymbol extends BaseSymbolInformation {
* See SymbolInformation#location for more details.
*/
location: Location | {
uri: string
};
uri: string
};
/**
* A data entry field that is preserved on a workspace symbol between a
* workspace symbol request and a workspace symbol resolve request.
@ -3547,13 +3549,13 @@ export interface SemanticTokensOptions extends WorkDoneProgressOptions {
*/
range?: boolean | {
};
};
/**
* Server supports providing semantic tokens for a full document.
*/
full?: boolean | {
delta?: boolean
};
delta?: boolean
};
}
/**
@ -4123,17 +4125,17 @@ export interface NotebookDocumentChangeEvent {
* Changes to cells
*/
cells?: {
structure?: {
array: NotebookCellArrayChange;
didOpen?: (TextDocumentItem)[];
didClose?: (TextDocumentIdentifier)[]
};
data?: (NotebookCell)[];
textContent?: ({
document: VersionedTextDocumentIdentifier;
changes: (TextDocumentContentChangeEvent)[]
})[]
};
structure?: {
array: NotebookCellArrayChange;
didOpen?: (TextDocumentItem)[];
didClose?: (TextDocumentIdentifier)[]
};
data?: (NotebookCell)[];
textContent?: ({
document: VersionedTextDocumentIdentifier;
changes: (TextDocumentContentChangeEvent)[]
})[]
};
}
/**
@ -4249,9 +4251,9 @@ export interface _InitializeParams extends WorkDoneProgressParams {
* @since 3.15.0
*/
clientInfo?: {
name: string;
version?: string
};
name: string;
version?: string
};
/**
* The locale the client is currently showing the user interface
* in. This must not necessarily be the locale of the operating
@ -4485,9 +4487,9 @@ export interface ServerCapabilities {
* Workspace specific server capabilities.
*/
workspace?: {
workspaceFolders?: WorkspaceFoldersServerCapabilities;
fileOperations?: FileOperationOptions
};
workspaceFolders?: WorkspaceFoldersServerCapabilities;
fileOperations?: FileOperationOptions
};
/**
* Experimental server capabilities.
*/
@ -4689,8 +4691,8 @@ export interface CompletionOptions extends WorkDoneProgressOptions {
* @since 3.17.0
*/
completionItem?: {
labelDetailsSupport?: boolean
};
labelDetailsSupport?: boolean
};
}
/**
@ -5330,16 +5332,16 @@ export interface NotebookDocumentSyncOptions {
* The notebooks to be synced
*/
notebookSelector: ({
notebook: string | NotebookDocumentFilter;
cells?: ({
language: string
})[]
} | {
notebook?: string | NotebookDocumentFilter;
cells: ({
language: string
})[]
})[];
notebook: string | NotebookDocumentFilter;
cells?: ({
language: string
})[]
} | {
notebook?: string | NotebookDocumentFilter;
cells: ({
language: string
})[]
})[];
/**
* Whether save notification should be forwarded to
* the server. Will only be honored if mode === `notebook`.
@ -5814,9 +5816,9 @@ export interface GeneralClientCapabilities {
* @since 3.17.0
*/
staleRequestSupport?: {
cancel: boolean;
retryOnContentModified: (string)[]
};
cancel: boolean;
retryOnContentModified: (string)[]
};
/**
* Client capabilities specific to regular expressions.
*
@ -5907,8 +5909,8 @@ export interface WorkspaceEditClientCapabilities {
* @since 3.16.0
*/
changeAnnotationSupport?: {
groupsOnLabel?: boolean
};
groupsOnLabel?: boolean
};
}
export interface DidChangeConfigurationClientCapabilities {
@ -5946,8 +5948,8 @@ export interface WorkspaceSymbolClientCapabilities {
* Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
*/
symbolKind?: {
valueSet?: (SymbolKind)[]
};
valueSet?: (SymbolKind)[]
};
/**
* The client supports tags on `SymbolInformation`.
* Clients supporting tags have to handle unknown tags gracefully.
@ -5955,8 +5957,8 @@ export interface WorkspaceSymbolClientCapabilities {
* @since 3.16.0
*/
tagSupport?: {
valueSet: (SymbolTag)[]
};
valueSet: (SymbolTag)[]
};
/**
* The client support partial workspace symbols. The client will send the
* request `workspaceSymbol/resolve` to the server to resolve additional
@ -5965,8 +5967,8 @@ export interface WorkspaceSymbolClientCapabilities {
* @since 3.17.0
*/
resolveSupport?: {
properties: (string)[]
};
properties: (string)[]
};
}
/**
@ -6160,26 +6162,26 @@ export interface CompletionClientCapabilities {
* capabilities.
*/
completionItem?: {
snippetSupport?: boolean;
commitCharactersSupport?: boolean;
documentationFormat?: (MarkupKind)[];
deprecatedSupport?: boolean;
preselectSupport?: boolean;
tagSupport?: {
valueSet: (CompletionItemTag)[]
};
insertReplaceSupport?: boolean;
resolveSupport?: {
properties: (string)[]
};
insertTextModeSupport?: {
valueSet: (InsertTextMode)[]
};
labelDetailsSupport?: boolean
};
snippetSupport?: boolean;
commitCharactersSupport?: boolean;
documentationFormat?: (MarkupKind)[];
deprecatedSupport?: boolean;
preselectSupport?: boolean;
tagSupport?: {
valueSet: (CompletionItemTag)[]
};
insertReplaceSupport?: boolean;
resolveSupport?: {
properties: (string)[]
};
insertTextModeSupport?: {
valueSet: (InsertTextMode)[]
};
labelDetailsSupport?: boolean
};
completionItemKind?: {
valueSet?: (CompletionItemKind)[]
};
valueSet?: (CompletionItemKind)[]
};
/**
* Defines how the client handles whitespace and indentation
* when accepting a completion item that uses multi line
@ -6200,8 +6202,8 @@ export interface CompletionClientCapabilities {
* @since 3.17.0
*/
completionList?: {
itemDefaults?: (string)[]
};
itemDefaults?: (string)[]
};
}
export interface HoverClientCapabilities {
@ -6229,12 +6231,12 @@ export interface SignatureHelpClientCapabilities {
* specific properties.
*/
signatureInformation?: {
documentationFormat?: (MarkupKind)[];
parameterInformation?: {
labelOffsetSupport?: boolean
};
activeParameterSupport?: boolean
};
documentationFormat?: (MarkupKind)[];
parameterInformation?: {
labelOffsetSupport?: boolean
};
activeParameterSupport?: boolean
};
/**
* The client supports to send additional context information for a
* `textDocument/signatureHelp` request. A client that opts into
@ -6347,8 +6349,8 @@ export interface DocumentSymbolClientCapabilities {
* `textDocument/documentSymbol` request.
*/
symbolKind?: {
valueSet?: (SymbolKind)[]
};
valueSet?: (SymbolKind)[]
};
/**
* The client supports hierarchical document symbols.
*/
@ -6361,8 +6363,8 @@ export interface DocumentSymbolClientCapabilities {
* @since 3.16.0
*/
tagSupport?: {
valueSet: (SymbolTag)[]
};
valueSet: (SymbolTag)[]
};
/**
* The client supports an additional label presented in the UI when
* registering a document symbol provider.
@ -6388,10 +6390,10 @@ export interface CodeActionClientCapabilities {
* @since 3.8.0
*/
codeActionLiteralSupport?: {
codeActionKind: {
valueSet: (CodeActionKind)[]
}
};
codeActionKind: {
valueSet: (CodeActionKind)[]
}
};
/**
* Whether code action supports the `isPreferred` property.
*
@ -6419,8 +6421,8 @@ export interface CodeActionClientCapabilities {
* @since 3.16.0
*/
resolveSupport?: {
properties: (string)[]
};
properties: (string)[]
};
/**
* Whether the client honors the change annotations in
* text edits and resource operations returned via the
@ -6564,16 +6566,16 @@ export interface FoldingRangeClientCapabilities {
* @since 3.17.0
*/
foldingRangeKind?: {
valueSet?: (FoldingRangeKind)[]
};
valueSet?: (FoldingRangeKind)[]
};
/**
* Specific options for the folding range.
*
* @since 3.17.0
*/
foldingRange?: {
collapsedText?: boolean
};
collapsedText?: boolean
};
}
export interface SelectionRangeClientCapabilities {
@ -6600,8 +6602,8 @@ export interface PublishDiagnosticsClientCapabilities {
* @since 3.15.0
*/
tagSupport?: {
valueSet: (DiagnosticTag)[]
};
valueSet: (DiagnosticTag)[]
};
/**
* Whether the client interprets the version property of the
* `textDocument/publishDiagnostics` notification's parameter.
@ -6658,13 +6660,13 @@ export interface SemanticTokensClientCapabilities {
* even decide to not show any semantic tokens at all.
*/
requests: {
range?: boolean | {
range?: boolean | {
};
full?: boolean | {
delta?: boolean
}
};
};
full?: boolean | {
delta?: boolean
}
};
/**
* The token types that the client supports.
*/
@ -6776,8 +6778,8 @@ export interface InlayHintClientCapabilities {
* hint.
*/
resolveSupport?: {
properties: (string)[]
};
properties: (string)[]
};
}
/**
@ -6838,8 +6840,8 @@ export interface ShowMessageRequestClientCapabilities {
* Capabilities specific to the `MessageActionItem` type.
*/
messageActionItem?: {
additionalPropertiesSupport?: boolean
};
additionalPropertiesSupport?: boolean
};
}
/**
@ -6898,7 +6900,7 @@ export interface MarkdownClientCapabilities {
* Represents a capability with its associated method and registration options type
*/
export class Capability<T> {
constructor(public readonly method: string) { }
constructor(public readonly method: string) {}
}
/**
@ -6966,85 +6968,85 @@ export const api = contract({
* document position. The request's parameter is of type {@link TextDocumentPositionParams}
* the response is of type {@link Definition} or a Thenable that resolves to such.
*/
textDocumentImplementation: unverifiedRequest<ImplementationParams, Definition | (DefinitionLink)[] | null>({ method: "textDocument/implementation" }),
textDocumentImplementation: unverifiedRequest<ImplementationParams, Definition | (DefinitionLink)[] | null>({ method: "textDocument/implementation" }).optional(),
/**
* A request to resolve the type definition locations of a symbol at a given text
* document position. The request's parameter is of type {@link TextDocumentPositionParams}
* the response is of type {@link Definition} or a Thenable that resolves to such.
*/
textDocumentTypeDefinition: unverifiedRequest<TypeDefinitionParams, Definition | (DefinitionLink)[] | null>({ method: "textDocument/typeDefinition" }),
textDocumentTypeDefinition: unverifiedRequest<TypeDefinitionParams, Definition | (DefinitionLink)[] | null>({ method: "textDocument/typeDefinition" }).optional(),
/**
* A request to list all color symbols found in a given text document. The request's
* parameter is of type {@link DocumentColorParams} the
* response is of type {@link ColorInformation ColorInformation[]} or a Thenable
* that resolves to such.
*/
textDocumentDocumentColor: unverifiedRequest<DocumentColorParams, (ColorInformation)[]>({ method: "textDocument/documentColor" }),
textDocumentDocumentColor: unverifiedRequest<DocumentColorParams, (ColorInformation)[]>({ method: "textDocument/documentColor" }).optional(),
/**
* A request to list all presentation for a color. The request's
* parameter is of type {@link ColorPresentationParams} the
* response is of type {@link ColorInformation ColorInformation[]} or a Thenable
* that resolves to such.
*/
textDocumentColorPresentation: unverifiedRequest<ColorPresentationParams, (ColorPresentation)[]>({ method: "textDocument/colorPresentation" }),
textDocumentColorPresentation: unverifiedRequest<ColorPresentationParams, (ColorPresentation)[]>({ method: "textDocument/colorPresentation" }).optional(),
/**
* A request to provide folding ranges in a document. The request's
* parameter is of type {@link FoldingRangeParams}, the
* response is of type {@link FoldingRangeList} or a Thenable
* that resolves to such.
*/
textDocumentFoldingRange: unverifiedRequest<FoldingRangeParams, (FoldingRange)[] | null>({ method: "textDocument/foldingRange" }),
textDocumentFoldingRange: unverifiedRequest<FoldingRangeParams, (FoldingRange)[] | null>({ method: "textDocument/foldingRange" }).optional(),
/**
* A request to resolve the type definition locations of a symbol at a given text
* document position. The request's parameter is of type {@link TextDocumentPositionParams}
* the response is of type {@link Declaration} or a typed array of {@link DeclarationLink}
* or a Thenable that resolves to such.
*/
textDocumentDeclaration: unverifiedRequest<DeclarationParams, Declaration | (DeclarationLink)[] | null>({ method: "textDocument/declaration" }),
textDocumentDeclaration: unverifiedRequest<DeclarationParams, Declaration | (DeclarationLink)[] | null>({ method: "textDocument/declaration" }).optional(),
/**
* A request to provide selection ranges in a document. The request's
* parameter is of type {@link SelectionRangeParams}, the
* response is of type {@link SelectionRange SelectionRange[]} or a Thenable
* that resolves to such.
*/
textDocumentSelectionRange: unverifiedRequest<SelectionRangeParams, (SelectionRange)[] | null>({ method: "textDocument/selectionRange" }),
textDocumentSelectionRange: unverifiedRequest<SelectionRangeParams, (SelectionRange)[] | null>({ method: "textDocument/selectionRange" }).optional(),
/**
* A request to result a `CallHierarchyItem` in a document at a given position.
* Can be used as an input to an incoming or outgoing call hierarchy.
*
* @since 3.16.0
*/
textDocumentPrepareCallHierarchy: unverifiedRequest<CallHierarchyPrepareParams, (CallHierarchyItem)[] | null>({ method: "textDocument/prepareCallHierarchy" }),
textDocumentPrepareCallHierarchy: unverifiedRequest<CallHierarchyPrepareParams, (CallHierarchyItem)[] | null>({ method: "textDocument/prepareCallHierarchy" }).optional(),
/**
* A request to resolve the incoming calls for a given `CallHierarchyItem`.
*
* @since 3.16.0
*/
callHierarchyIncomingCalls: unverifiedRequest<CallHierarchyIncomingCallsParams, (CallHierarchyIncomingCall)[] | null>({ method: "callHierarchy/incomingCalls" }),
callHierarchyIncomingCalls: unverifiedRequest<CallHierarchyIncomingCallsParams, (CallHierarchyIncomingCall)[] | null>({ method: "callHierarchy/incomingCalls" }).optional(),
/**
* A request to resolve the outgoing calls for a given `CallHierarchyItem`.
*
* @since 3.16.0
*/
callHierarchyOutgoingCalls: unverifiedRequest<CallHierarchyOutgoingCallsParams, (CallHierarchyOutgoingCall)[] | null>({ method: "callHierarchy/outgoingCalls" }),
callHierarchyOutgoingCalls: unverifiedRequest<CallHierarchyOutgoingCallsParams, (CallHierarchyOutgoingCall)[] | null>({ method: "callHierarchy/outgoingCalls" }).optional(),
/**
* @since 3.16.0
*/
textDocumentSemanticTokensFull: unverifiedRequest<SemanticTokensParams, SemanticTokens | null>({ method: "textDocument/semanticTokens/full" }),
textDocumentSemanticTokensFull: unverifiedRequest<SemanticTokensParams, SemanticTokens | null>({ method: "textDocument/semanticTokens/full" }).optional(),
/**
* @since 3.16.0
*/
textDocumentSemanticTokensFullDelta: unverifiedRequest<SemanticTokensDeltaParams, SemanticTokens | SemanticTokensDelta | null>({ method: "textDocument/semanticTokens/full/delta" }),
textDocumentSemanticTokensFullDelta: unverifiedRequest<SemanticTokensDeltaParams, SemanticTokens | SemanticTokensDelta | null>({ method: "textDocument/semanticTokens/full/delta" }).optional(),
/**
* @since 3.16.0
*/
textDocumentSemanticTokensRange: unverifiedRequest<SemanticTokensRangeParams, SemanticTokens | null>({ method: "textDocument/semanticTokens/range" }),
textDocumentSemanticTokensRange: unverifiedRequest<SemanticTokensRangeParams, SemanticTokens | null>({ method: "textDocument/semanticTokens/range" }).optional(),
/**
* A request to provide ranges that can be edited together.
*
* @since 3.16.0
*/
textDocumentLinkedEditingRange: unverifiedRequest<LinkedEditingRangeParams, LinkedEditingRanges | null>({ method: "textDocument/linkedEditingRange" }),
textDocumentLinkedEditingRange: unverifiedRequest<LinkedEditingRangeParams, LinkedEditingRanges | null>({ method: "textDocument/linkedEditingRange" }).optional(),
/**
* The will create files request is sent from the client to the server before files are actually
* created as long as the creation is triggered from within the client.
@ -7055,46 +7057,46 @@ export const api = contract({
*
* @since 3.16.0
*/
workspaceWillCreateFiles: unverifiedRequest<CreateFilesParams, WorkspaceEdit | null>({ method: "workspace/willCreateFiles" }),
workspaceWillCreateFiles: unverifiedRequest<CreateFilesParams, WorkspaceEdit | null>({ method: "workspace/willCreateFiles" }).optional(),
/**
* The will rename files request is sent from the client to the server before files are actually
* renamed as long as the rename is triggered from within the client.
*
* @since 3.16.0
*/
workspaceWillRenameFiles: unverifiedRequest<RenameFilesParams, WorkspaceEdit | null>({ method: "workspace/willRenameFiles" }),
workspaceWillRenameFiles: unverifiedRequest<RenameFilesParams, WorkspaceEdit | null>({ method: "workspace/willRenameFiles" }).optional(),
/**
* The did delete files notification is sent from the client to the server when
* files were deleted from within the client.
*
* @since 3.16.0
*/
workspaceWillDeleteFiles: unverifiedRequest<DeleteFilesParams, WorkspaceEdit | null>({ method: "workspace/willDeleteFiles" }),
workspaceWillDeleteFiles: unverifiedRequest<DeleteFilesParams, WorkspaceEdit | null>({ method: "workspace/willDeleteFiles" }).optional(),
/**
* A request to get the moniker of a symbol at a given text document position.
* The request parameter is of type {@link TextDocumentPositionParams}.
* The response is of type {@link Moniker Moniker[]} or `null`.
*/
textDocumentMoniker: unverifiedRequest<MonikerParams, (Moniker)[] | null>({ method: "textDocument/moniker" }),
textDocumentMoniker: unverifiedRequest<MonikerParams, (Moniker)[] | null>({ method: "textDocument/moniker" }).optional(),
/**
* A request to result a `TypeHierarchyItem` in a document at a given position.
* Can be used as an input to a subtypes or supertypes type hierarchy.
*
* @since 3.17.0
*/
textDocumentPrepareTypeHierarchy: unverifiedRequest<TypeHierarchyPrepareParams, (TypeHierarchyItem)[] | null>({ method: "textDocument/prepareTypeHierarchy" }),
textDocumentPrepareTypeHierarchy: unverifiedRequest<TypeHierarchyPrepareParams, (TypeHierarchyItem)[] | null>({ method: "textDocument/prepareTypeHierarchy" }).optional(),
/**
* A request to resolve the supertypes for a given `TypeHierarchyItem`.
*
* @since 3.17.0
*/
typeHierarchySupertypes: unverifiedRequest<TypeHierarchySupertypesParams, (TypeHierarchyItem)[] | null>({ method: "typeHierarchy/supertypes" }),
typeHierarchySupertypes: unverifiedRequest<TypeHierarchySupertypesParams, (TypeHierarchyItem)[] | null>({ method: "typeHierarchy/supertypes" }).optional(),
/**
* A request to resolve the subtypes for a given `TypeHierarchyItem`.
*
* @since 3.17.0
*/
typeHierarchySubtypes: unverifiedRequest<TypeHierarchySubtypesParams, (TypeHierarchyItem)[] | null>({ method: "typeHierarchy/subtypes" }),
typeHierarchySubtypes: unverifiedRequest<TypeHierarchySubtypesParams, (TypeHierarchyItem)[] | null>({ method: "typeHierarchy/subtypes" }).optional(),
/**
* A request to provide inline values in a document. The request's parameter is of
* type {@link InlineValueParams}, the response is of type
@ -7102,7 +7104,7 @@ export const api = contract({
*
* @since 3.17.0
*/
textDocumentInlineValue: unverifiedRequest<InlineValueParams, (InlineValue)[] | null>({ method: "textDocument/inlineValue" }),
textDocumentInlineValue: unverifiedRequest<InlineValueParams, (InlineValue)[] | null>({ method: "textDocument/inlineValue" }).optional(),
/**
* A request to provide inlay hints in a document. The request's parameter is of
* type {@link InlayHintsParams}, the response is of type
@ -7110,7 +7112,7 @@ export const api = contract({
*
* @since 3.17.0
*/
textDocumentInlayHint: unverifiedRequest<InlayHintParams, (InlayHint)[] | null>({ method: "textDocument/inlayHint" }),
textDocumentInlayHint: unverifiedRequest<InlayHintParams, (InlayHint)[] | null>({ method: "textDocument/inlayHint" }).optional(),
/**
* A request to resolve additional properties for an inlay hint.
* The request's parameter is of type {@link InlayHint}, the response is
@ -7118,19 +7120,19 @@ export const api = contract({
*
* @since 3.17.0
*/
inlayHintResolve: unverifiedRequest<InlayHint, InlayHint>({ method: "inlayHint/resolve" }),
inlayHintResolve: unverifiedRequest<InlayHint, InlayHint>({ method: "inlayHint/resolve" }).optional(),
/**
* The document diagnostic request definition.
*
* @since 3.17.0
*/
textDocumentDiagnostic: unverifiedRequest<DocumentDiagnosticParams, DocumentDiagnosticReport>({ method: "textDocument/diagnostic" }),
textDocumentDiagnostic: unverifiedRequest<DocumentDiagnosticParams, DocumentDiagnosticReport>({ method: "textDocument/diagnostic" }).optional(),
/**
* The workspace diagnostic request definition.
*
* @since 3.17.0
*/
workspaceDiagnostic: unverifiedRequest<WorkspaceDiagnosticParams, WorkspaceDiagnosticReport>({ method: "workspace/diagnostic" }),
workspaceDiagnostic: unverifiedRequest<WorkspaceDiagnosticParams, WorkspaceDiagnosticReport>({ method: "workspace/diagnostic" }).optional(),
/**
* A request to provide inline completions in a document. The request's parameter is of
* type {@link InlineCompletionParams}, the response is of type
@ -7139,7 +7141,7 @@ export const api = contract({
* @since 3.18.0
* @proposed
*/
textDocumentInlineCompletion: unverifiedRequest<InlineCompletionParams, InlineCompletionList | (InlineCompletionItem)[] | null>({ method: "textDocument/inlineCompletion" }),
textDocumentInlineCompletion: unverifiedRequest<InlineCompletionParams, InlineCompletionList | (InlineCompletionItem)[] | null>({ method: "textDocument/inlineCompletion" }).optional(),
/**
* The initialize request is sent from the client to the server.
* It is sent once as the request after starting up the server.
@ -7147,14 +7149,14 @@ export const api = contract({
* the response if of type {@link InitializeResult} of a Thenable that
* resolves to such.
*/
initialize: unverifiedRequest<InitializeParams, InitializeResult>({ method: "initialize" }),
initialize: unverifiedRequest<InitializeParams, InitializeResult>({ method: "initialize" }).optional(),
/**
* A shutdown request is sent from the client to the server.
* It is sent once when the client decides to shutdown the
* server. The only notification that is sent after a shutdown request
* is the exit event.
*/
shutdown: unverifiedRequest<void, null>({ method: "shutdown" }),
shutdown: unverifiedRequest<void, null>({ method: "shutdown" }).optional(),
/**
* A document will save request is sent from the client to the server before
* the document is actually saved. The request can return an array of TextEdits
@ -7163,7 +7165,7 @@ export const api = contract({
* server constantly fails on this request. This is done to keep the save fast and
* reliable.
*/
textDocumentWillSaveWaitUntil: unverifiedRequest<WillSaveTextDocumentParams, (TextEdit)[] | null>({ method: "textDocument/willSaveWaitUntil" }),
textDocumentWillSaveWaitUntil: unverifiedRequest<WillSaveTextDocumentParams, (TextEdit)[] | null>({ method: "textDocument/willSaveWaitUntil" }).optional(),
/**
* Request to request completion at a given text document position. The request's
* parameter is of type {@link TextDocumentPosition} the response
@ -7175,58 +7177,58 @@ export const api = contract({
* request. However, properties that are needed for the initial sorting and filtering, like `sortText`,
* `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.
*/
textDocumentCompletion: unverifiedRequest<CompletionParams, (CompletionItem)[] | CompletionList | null>({ method: "textDocument/completion" }),
textDocumentCompletion: unverifiedRequest<CompletionParams, (CompletionItem)[] | CompletionList | null>({ method: "textDocument/completion" }).optional(),
/**
* Request to resolve additional information for a given completion item.The request's
* parameter is of type {@link CompletionItem} the response
* is of type {@link CompletionItem} or a Thenable that resolves to such.
*/
completionItemResolve: unverifiedRequest<CompletionItem, CompletionItem>({ method: "completionItem/resolve" }),
completionItemResolve: unverifiedRequest<CompletionItem, CompletionItem>({ method: "completionItem/resolve" }).optional(),
/**
* Request to request hover information at a given text document position. The request's
* parameter is of type {@link TextDocumentPosition} the response is of
* type {@link Hover} or a Thenable that resolves to such.
*/
textDocumentHover: unverifiedRequest<HoverParams, Hover | null>({ method: "textDocument/hover" }),
textDocumentSignatureHelp: unverifiedRequest<SignatureHelpParams, SignatureHelp | null>({ method: "textDocument/signatureHelp" }),
textDocumentHover: unverifiedRequest<HoverParams, Hover | null>({ method: "textDocument/hover" }).optional(),
textDocumentSignatureHelp: unverifiedRequest<SignatureHelpParams, SignatureHelp | null>({ method: "textDocument/signatureHelp" }).optional(),
/**
* A request to resolve the definition location of a symbol at a given text
* document position. The request's parameter is of type {@link TextDocumentPosition}
* the response is of either type {@link Definition} or a typed array of
* {@link DefinitionLink} or a Thenable that resolves to such.
*/
textDocumentDefinition: unverifiedRequest<DefinitionParams, Definition | (DefinitionLink)[] | null>({ method: "textDocument/definition" }),
textDocumentDefinition: unverifiedRequest<DefinitionParams, Definition | (DefinitionLink)[] | null>({ method: "textDocument/definition" }).optional(),
/**
* A request to resolve project-wide references for the symbol denoted
* by the given text document position. The request's parameter is of
* type {@link ReferenceParams} the response is of type
* {@link Location Location[]} or a Thenable that resolves to such.
*/
textDocumentReferences: unverifiedRequest<ReferenceParams, (Location)[] | null>({ method: "textDocument/references" }),
textDocumentReferences: unverifiedRequest<ReferenceParams, (Location)[] | null>({ method: "textDocument/references" }).optional(),
/**
* Request to resolve a {@link DocumentHighlight} for a given
* text document position. The request's parameter is of type {@link TextDocumentPosition}
* the request response is an array of type {@link DocumentHighlight}
* or a Thenable that resolves to such.
*/
textDocumentDocumentHighlight: unverifiedRequest<DocumentHighlightParams, (DocumentHighlight)[] | null>({ method: "textDocument/documentHighlight" }),
textDocumentDocumentHighlight: unverifiedRequest<DocumentHighlightParams, (DocumentHighlight)[] | null>({ method: "textDocument/documentHighlight" }).optional(),
/**
* A request to list all symbols found in a given text document. The request's
* parameter is of type {@link TextDocumentIdentifier} the
* response is of type {@link SymbolInformation SymbolInformation[]} or a Thenable
* that resolves to such.
*/
textDocumentDocumentSymbol: unverifiedRequest<DocumentSymbolParams, (SymbolInformation)[] | (DocumentSymbol)[] | null>({ method: "textDocument/documentSymbol" }),
textDocumentDocumentSymbol: unverifiedRequest<DocumentSymbolParams, (SymbolInformation)[] | (DocumentSymbol)[] | null>({ method: "textDocument/documentSymbol" }).optional(),
/**
* A request to provide commands for the given text document and range.
*/
textDocumentCodeAction: unverifiedRequest<CodeActionParams, (Command | CodeAction)[] | null>({ method: "textDocument/codeAction" }),
textDocumentCodeAction: unverifiedRequest<CodeActionParams, (Command | CodeAction)[] | null>({ method: "textDocument/codeAction" }).optional(),
/**
* Request to resolve additional information for a given code action.The request's
* parameter is of type {@link CodeAction} the response
* is of type {@link CodeAction} or a Thenable that resolves to such.
*/
codeActionResolve: unverifiedRequest<CodeAction, CodeAction>({ method: "codeAction/resolve" }),
codeActionResolve: unverifiedRequest<CodeAction, CodeAction>({ method: "codeAction/resolve" }).optional(),
/**
* A request to list project-wide symbols matching the query string given
* by the {@link WorkspaceSymbolParams}. The response is
@ -7238,66 +7240,66 @@ export const api = contract({
* `workspace.symbol.resolveSupport`.
*
*/
workspaceSymbol: unverifiedRequest<WorkspaceSymbolParams, (SymbolInformation)[] | (WorkspaceSymbol)[] | null>({ method: "workspace/symbol" }),
workspaceSymbol: unverifiedRequest<WorkspaceSymbolParams, (SymbolInformation)[] | (WorkspaceSymbol)[] | null>({ method: "workspace/symbol" }).optional(),
/**
* A request to resolve the range inside the workspace
* symbol's location.
*
* @since 3.17.0
*/
workspaceSymbolResolve: unverifiedRequest<WorkspaceSymbol, WorkspaceSymbol>({ method: "workspaceSymbol/resolve" }),
workspaceSymbolResolve: unverifiedRequest<WorkspaceSymbol, WorkspaceSymbol>({ method: "workspaceSymbol/resolve" }).optional(),
/**
* A request to provide code lens for the given text document.
*/
textDocumentCodeLens: unverifiedRequest<CodeLensParams, (CodeLens)[] | null>({ method: "textDocument/codeLens" }),
textDocumentCodeLens: unverifiedRequest<CodeLensParams, (CodeLens)[] | null>({ method: "textDocument/codeLens" }).optional(),
/**
* A request to resolve a command for a given code lens.
*/
codeLensResolve: unverifiedRequest<CodeLens, CodeLens>({ method: "codeLens/resolve" }),
codeLensResolve: unverifiedRequest<CodeLens, CodeLens>({ method: "codeLens/resolve" }).optional(),
/**
* A request to provide document links
*/
textDocumentDocumentLink: unverifiedRequest<DocumentLinkParams, (DocumentLink)[] | null>({ method: "textDocument/documentLink" }),
textDocumentDocumentLink: unverifiedRequest<DocumentLinkParams, (DocumentLink)[] | null>({ method: "textDocument/documentLink" }).optional(),
/**
* Request to resolve additional information for a given document link. The request's
* parameter is of type {@link DocumentLink} the response
* is of type {@link DocumentLink} or a Thenable that resolves to such.
*/
documentLinkResolve: unverifiedRequest<DocumentLink, DocumentLink>({ method: "documentLink/resolve" }),
documentLinkResolve: unverifiedRequest<DocumentLink, DocumentLink>({ method: "documentLink/resolve" }).optional(),
/**
* A request to format a whole document.
*/
textDocumentFormatting: unverifiedRequest<DocumentFormattingParams, (TextEdit)[] | null>({ method: "textDocument/formatting" }),
textDocumentFormatting: unverifiedRequest<DocumentFormattingParams, (TextEdit)[] | null>({ method: "textDocument/formatting" }).optional(),
/**
* A request to format a range in a document.
*/
textDocumentRangeFormatting: unverifiedRequest<DocumentRangeFormattingParams, (TextEdit)[] | null>({ method: "textDocument/rangeFormatting" }),
textDocumentRangeFormatting: unverifiedRequest<DocumentRangeFormattingParams, (TextEdit)[] | null>({ method: "textDocument/rangeFormatting" }).optional(),
/**
* A request to format ranges in a document.
*
* @since 3.18.0
* @proposed
*/
textDocumentRangesFormatting: unverifiedRequest<DocumentRangesFormattingParams, (TextEdit)[] | null>({ method: "textDocument/rangesFormatting" }),
textDocumentRangesFormatting: unverifiedRequest<DocumentRangesFormattingParams, (TextEdit)[] | null>({ method: "textDocument/rangesFormatting" }).optional(),
/**
* A request to format a document on type.
*/
textDocumentOnTypeFormatting: unverifiedRequest<DocumentOnTypeFormattingParams, (TextEdit)[] | null>({ method: "textDocument/onTypeFormatting" }),
textDocumentOnTypeFormatting: unverifiedRequest<DocumentOnTypeFormattingParams, (TextEdit)[] | null>({ method: "textDocument/onTypeFormatting" }).optional(),
/**
* A request to rename a symbol.
*/
textDocumentRename: unverifiedRequest<RenameParams, WorkspaceEdit | null>({ method: "textDocument/rename" }),
textDocumentRename: unverifiedRequest<RenameParams, WorkspaceEdit | null>({ method: "textDocument/rename" }).optional(),
/**
* A request to test and perform the setup necessary for a rename.
*
* @since 3.16 - support for default behavior
*/
textDocumentPrepareRename: unverifiedRequest<PrepareRenameParams, PrepareRenameResult | null>({ method: "textDocument/prepareRename" }),
textDocumentPrepareRename: unverifiedRequest<PrepareRenameParams, PrepareRenameResult | null>({ method: "textDocument/prepareRename" }).optional(),
/**
* A request send from the client to the server to execute a command. The request might return
* a workspace edit which the client will apply to the workspace.
*/
workspaceExecuteCommand: unverifiedRequest<ExecuteCommandParams, LSPAny | null>({ method: "workspace/executeCommand" }),
workspaceExecuteCommand: unverifiedRequest<ExecuteCommandParams, LSPAny | null>({ method: "workspace/executeCommand" }).optional(),
/**
* The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace
* folder configuration changes.

View file

@ -1,5 +1,6 @@
import './style.css';
import * as monaco from '../../src/editor/editor.main';
import type { WorkerImpl } from './worker';
monaco.languages.register({ id: 'typescript' });
@ -11,3 +12,33 @@ const editor = monaco.editor.create(document.getElementById('root')!, {
language: 'typescript',
theme: 'vs-dark',
});
export class ClientImpl extends Disposable {
private readonly _workerImpl: WorkerImpl;
constructor() {
super();
const w = new Worker(new URL('./worker.ts', import.meta.url), { type: 'module' });
const t = monaco.lsp.createTransportToWorker(w);
const client = this._register(new monaco.lsp.MonacoLspClient(t));
this._workerImpl = getRemoteObject<WorkerImpl>(client.channel);
this._register(registerLocalObject(client.channel, this));
this._workerImpl.$setTextToWarnFor('warn', 'This is a warning from the LSP server!');
// this should now see all text documents
this._workerImpl.$getDiagnosticsCount().then(count => {
console.log(`Diagnostics count: ${count}`);
});
}
$callback(): void {
console.log('Callback from server received!');
}
}

View file

@ -0,0 +1,117 @@
import * as m from '@vscode/monaco-lsp-client/src/types';
import { createTransportFromWorkerToParent } from '@hediet/json-rpc-browser';
import { TypedChannel, IMessageTransport } from '@hediet/json-rpc';
import type { ClientImpl } from './main';
class LspConnection {
constructor(
public readonly server: typeof client,
public readonly channel: TypedChannel,
) { }
}
class TextDocuments {
constructor(connection: LspConnection) {
const { client } = m.api.registerServer(connection.channel, {
textDocumentDidOpen: async (arg, info) => {
arg.textDocument.text;
},
textDocumentDidClose: async (arg, info) => {
arg.textDocument.uri;
},
textDocumentDidChange: async (arg, info) => {
arg.contentChanges;
arg.textDocument.uri;
},
});
}
getTextModel(uri: string): TextModel | null {
return null;
}
getTextModelOrThrow(uri: string | m.TextDocumentIdentifier): TextModel {
return null;
}
}
class TextModel {
getValue(): string {
}
}
class LspServer {
public static create(transport: IMessageTransport): LspServer { }
public readonly textDocuments: TextDocuments;
public readonly server: typeof m.api.TClientInterface;
public readonly channel: TypedChannel;
constructor(
channel: TypedChannel,
) {
}
public startListen(): void { }
}
const channel = TypedChannel.fromTransport(transport);
const { client } = m.api.registerServer(channel, {
initialize: async (arg, info) => {
return {
capabilities: {
textDocumentSync: m.TextDocumentSyncKind.Full,
diagnosticProvider: {
interFileDependencies: false,
workspaceDiagnostics: false,
},
}
};
},
});
export class WorkerImpl extends Disposable {
private readonly _clientImpl: ClientImpl;
private readonly _server: LspServer;
constructor() {
super();
this._server = LspServer.create(createTransportFromWorkerToParent());
this._clientImpl = getRemoteObject<ClientImpl>(server.channel);
this._register(registerLocalObject(server.channel, this));
this._clientImpl.$callback();
m.api.registerServer(this._server.channel, {
textDocumentDiagnostic: async (arg) => {
const doc = this._server.textDocuments.getTextModelOrThrow(arg.textDocument);
return {
items: [],
kind: "full",
};
},
});
}
$setTextToWarnFor(text: string, message: string): void {
this._server.server.workspaceDiagnosticRefresh();
}
$getDiagnosticsCount(): Promise<number> {
return 0;
}
}