diff --git a/package-lock.json b/package-lock.json index 915a1b3..01ba48a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -249,92 +249,101 @@ "integrity": "sha512-YslZMgtJUyuMbZ+aKvfF3x1f5liK4mWNxghFRv7jqRR9C3R3fAOGTTKvxXDa2Y1s9zSbcpuO0cAxDYsc9SrXoQ==" }, "node_modules/@codingame/monaco-vscode-configuration-service-override": { - "version": "1.82.4", - "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-configuration-service-override/-/monaco-vscode-configuration-service-override-1.82.4.tgz", - "integrity": "sha512-czLqSL8TpFOXlHC0xCZcHkCk7b8pCeFw4nZIgNPqaVxhgwBdhBUXhRlRPZSAigWca9kPmMf9+rIfEgeM9Xmf8w==", + "version": "1.82.5", + "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-configuration-service-override/-/monaco-vscode-configuration-service-override-1.82.5.tgz", + "integrity": "sha512-Oas1EdniEZbvDrxBcVxTemoJYMHwWpD2PLTlFv37aeRVpuyk5DKqQu5HUhNVdN1epwCFRZ8efGpJ6nV+d5hh+A==", "dependencies": { "monaco-editor": "0.43.0", - "vscode": "npm:@codingame/monaco-vscode-api@1.82.4" + "vscode": "npm:@codingame/monaco-vscode-api@1.82.5" } }, "node_modules/@codingame/monaco-vscode-editor-service-override": { - "version": "1.82.4", - "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-editor-service-override/-/monaco-vscode-editor-service-override-1.82.4.tgz", - "integrity": "sha512-w88Lq0rBSBr9nLf2YRvxafHvloz0TKT2b3tfoNo+W+IlChdvIT2RvxjWPrI7w/HFOe/IkmxNQ7Pi243Gr/2p7A==", + "version": "1.82.5", + "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-editor-service-override/-/monaco-vscode-editor-service-override-1.82.5.tgz", + "integrity": "sha512-IU3oEPdxJHgfzVKPEow4tzt0lA1p+oQrVAErAP/Fz02DHKydDI/Zjdn65dqGqc3jNaBq8DZGdrvLwMcL0jwb1Q==", "dependencies": { "monaco-editor": "0.43.0", - "vscode": "npm:@codingame/monaco-vscode-api@1.82.4" + "vscode": "npm:@codingame/monaco-vscode-api@1.82.5" + } + }, + "node_modules/@codingame/monaco-vscode-files-service-override": { + "version": "1.82.5", + "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-files-service-override/-/monaco-vscode-files-service-override-1.82.5.tgz", + "integrity": "sha512-vQ3RuzcXaD6q+9VbaDvg8f1Xt/w3+CyEBYim3xDpZyz/XrRGTPkRUX88w/KoNQIDVL9CIZGqKE7S2YsIl/BAjw==", + "dependencies": { + "monaco-editor": "0.43.0", + "vscode": "npm:@codingame/monaco-vscode-api@1.82.5" } }, "node_modules/@codingame/monaco-vscode-json-default-extension": { - "version": "1.82.4", - "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-json-default-extension/-/monaco-vscode-json-default-extension-1.82.4.tgz", - "integrity": "sha512-i3drKeFAUaI+wnWurBqB2XlYod+aVGzpacxQyRd6ERXF4IwEQ0gwOktneipJs4pjmMFYI/X3/xAGVjVi2BaLyQ==", + "version": "1.82.5", + "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-json-default-extension/-/monaco-vscode-json-default-extension-1.82.5.tgz", + "integrity": "sha512-0OzbW76ViMVHhc5SsxgU4HNgVzgxLO5SBN2WXmBcRCTN2peWmjXmTMLqfiGoMsgj07hPP9WayFpbUSsIi/csBA==", "dependencies": { - "vscode": "npm:@codingame/monaco-vscode-api@1.82.4" + "vscode": "npm:@codingame/monaco-vscode-api@1.82.5" } }, "node_modules/@codingame/monaco-vscode-keybindings-service-override": { - "version": "1.82.4", - "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-keybindings-service-override/-/monaco-vscode-keybindings-service-override-1.82.4.tgz", - "integrity": "sha512-a2wVRUJP3cLnsPnyGLhALp2Y6oLlo/2+GsPjMrkYMBk1ZOMh63P8129qnN+9ZtgGNjlqLBuBqmJUqYJd3ToGww==", + "version": "1.82.5", + "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-keybindings-service-override/-/monaco-vscode-keybindings-service-override-1.82.5.tgz", + "integrity": "sha512-rDBNwUkrcgyRRKyF9CedQEI7ek0eeOeEtYs6X9+dzMlwLoz2CNa9R+S6l8BI2B+3kK2J+46Ph4OrDay3gTSWwA==", "dependencies": { "monaco-editor": "0.43.0", - "vscode": "npm:@codingame/monaco-vscode-api@1.82.4" + "vscode": "npm:@codingame/monaco-vscode-api@1.82.5" } }, "node_modules/@codingame/monaco-vscode-languages-service-override": { - "version": "1.82.4", - "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-languages-service-override/-/monaco-vscode-languages-service-override-1.82.4.tgz", - "integrity": "sha512-+UbK0iLL+yOGYodlB9vC09qWzgzGEwqef6rstVSwpf7c86SlH6WOAtrb4s+lfCnyvYkauvmgcElvL+wO89PrxQ==", + "version": "1.82.5", + "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-languages-service-override/-/monaco-vscode-languages-service-override-1.82.5.tgz", + "integrity": "sha512-zxwoi1dtwG7b2NLN6+uRG6rhBFvpB+7zpB6GmegOhdx8USMiVNejaPLbNrcYqDw8hObFr9WC465JK3LbJA+JHQ==", "dependencies": { "monaco-editor": "0.43.0", - "vscode": "npm:@codingame/monaco-vscode-api@1.82.4" + "vscode": "npm:@codingame/monaco-vscode-api@1.82.5" } }, "node_modules/@codingame/monaco-vscode-model-service-override": { - "version": "1.82.4", - "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-model-service-override/-/monaco-vscode-model-service-override-1.82.4.tgz", - "integrity": "sha512-1mr6+5GF+V/Ny98hONC/Amubf71mVn9aY/AeX1LQCCnRTJg5SrZtSTbZk6x+5Fp4zweOm9FoNYvr5/kA6qYXuw==", + "version": "1.82.5", + "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-model-service-override/-/monaco-vscode-model-service-override-1.82.5.tgz", + "integrity": "sha512-D/6KK0wwPcdQE9cax48tgMFopqHCliUcgqk2n7iPv3Cch0gVFdIIVfWiJQbZ7VUVz5Ig/UeeRcXfqGRHUqwzWQ==", "dependencies": { "monaco-editor": "0.43.0", - "vscode": "npm:@codingame/monaco-vscode-api@1.82.4" + "vscode": "npm:@codingame/monaco-vscode-api@1.82.5" } }, "node_modules/@codingame/monaco-vscode-python-default-extension": { - "version": "1.82.4", - "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-python-default-extension/-/monaco-vscode-python-default-extension-1.82.4.tgz", - "integrity": "sha512-VtSzhTJEKdMeJTWcoD/36WkgVMwD2MpdDqWufu9vukca3MQyWu9KS2H28QN6w0VkKcLY4GtUilqMH6EuPPdPsw==", + "version": "1.82.5", + "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-python-default-extension/-/monaco-vscode-python-default-extension-1.82.5.tgz", + "integrity": "sha512-cQBsGAPIV4M6twV5sEWKlm7UWp2/ANxlF51V2vyOziyKUzBl/kPXWThyU4O6dD1SunbyR9Gr1WY+jq68zgmtLA==", "dependencies": { - "vscode": "npm:@codingame/monaco-vscode-api@1.82.4" + "vscode": "npm:@codingame/monaco-vscode-api@1.82.5" } }, "node_modules/@codingame/monaco-vscode-textmate-service-override": { - "version": "1.82.4", - "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-textmate-service-override/-/monaco-vscode-textmate-service-override-1.82.4.tgz", - "integrity": "sha512-h/S1S+4ZqY2CcGfmTdIPhYc/2l0OYARWSC/GBnHLSnmOi3R+AgmZCnZtQvest9ZfRBjsu7RWPNiJO5U2O5VM/Q==", + "version": "1.82.5", + "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-textmate-service-override/-/monaco-vscode-textmate-service-override-1.82.5.tgz", + "integrity": "sha512-5mUVYKyxftEmOJvjZl5QSVv7RCTRBOL0mGTQZVsElkrvWfwwkvxSZo1ug9Ot6quuRrxuZ4tk/i9VnrnU+U4PeA==", "dependencies": { "monaco-editor": "0.43.0", - "vscode": "npm:@codingame/monaco-vscode-api@1.82.4", + "vscode": "npm:@codingame/monaco-vscode-api@1.82.5", "vscode-oniguruma": "^2.0.0", "vscode-textmate": "^9.0.0" } }, "node_modules/@codingame/monaco-vscode-theme-defaults-default-extension": { - "version": "1.82.4", - "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-theme-defaults-default-extension/-/monaco-vscode-theme-defaults-default-extension-1.82.4.tgz", - "integrity": "sha512-2uCHJGXqtA21pQKfgq+nlc5g6RoBLrjvFID0xhjYKOjRbFywV/YGNfNtFVRIXy0SP8ZK2M9ownNbcewbt3mEjQ==", + "version": "1.82.5", + "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-theme-defaults-default-extension/-/monaco-vscode-theme-defaults-default-extension-1.82.5.tgz", + "integrity": "sha512-8bDhQtNlmNG0GHmSNuEwHDN5eaU50LYhS+R0FvKhQQ1Gg+w1VKliguS4YtWekNjfCpM4MfI9tg3nMc0GTcXgoQ==", "dependencies": { - "vscode": "npm:@codingame/monaco-vscode-api@1.82.4" + "vscode": "npm:@codingame/monaco-vscode-api@1.82.5" } }, "node_modules/@codingame/monaco-vscode-theme-service-override": { - "version": "1.82.4", - "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-theme-service-override/-/monaco-vscode-theme-service-override-1.82.4.tgz", - "integrity": "sha512-Clp4aRWF1NNvJftrKbZkn2G5YK2rl7wFEttLHLoZkp7NWIbdmdDvW+Ylg1riE2KZRVD11mGvt5EWvsOyHxYYhA==", + "version": "1.82.5", + "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-theme-service-override/-/monaco-vscode-theme-service-override-1.82.5.tgz", + "integrity": "sha512-CJX0+e6DNKs+QFkI69otp4VpqJFRifY/OGhEd6QsEN56n6wHT/mRSZtoft3Tg581GZ1EFhQkkn7G5KuHrx+CPA==", "dependencies": { "monaco-editor": "0.43.0", - "vscode": "npm:@codingame/monaco-vscode-api@1.82.4" + "vscode": "npm:@codingame/monaco-vscode-api@1.82.5" } }, "node_modules/@cspotcode/source-map-support": { @@ -1922,12 +1931,6 @@ "node": ">=10" } }, - "node_modules/archiver/node_modules/async": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", - "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", - "dev": true - }, "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -1986,12 +1989,10 @@ } }, "node_modules/async": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", - "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", - "dependencies": { - "lodash": "^4.17.14" - } + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", + "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", + "dev": true }, "node_modules/b4a": { "version": "1.6.4", @@ -2035,6 +2036,11 @@ "node": ">= 0.8" } }, + "node_modules/basic-auth/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, "node_modules/basic-ftp": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.0.3.tgz", @@ -2423,25 +2429,6 @@ "node": ">= 0.6" } }, - "node_modules/content-disposition/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/content-type": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", @@ -2784,6 +2771,12 @@ "util-deprecate": "~1.0.1" } }, + "node_modules/duplexer2/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, "node_modules/duplexer2/node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -3248,25 +3241,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, - "node_modules/express/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/extract-zip": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", @@ -4339,9 +4313,9 @@ } }, "node_modules/keyv": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz", - "integrity": "sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug==", + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", "dev": true, "dependencies": { "json-buffer": "3.0.1" @@ -4470,6 +4444,12 @@ "util-deprecate": "~1.0.1" } }, + "node_modules/lazystream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, "node_modules/lazystream/node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -4861,16 +4841,16 @@ "link": true }, "node_modules/monaco-languageclient": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/monaco-languageclient/-/monaco-languageclient-6.5.2.tgz", - "integrity": "sha512-9SboGjIpGMVwxStLoWTfztNotxDEvNTPfxLToHOJZUo6YWkJI3MLdH+PsCM95VygBSxnBI6GF3Ab8Jslp6L1Nw==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/monaco-languageclient/-/monaco-languageclient-6.5.3.tgz", + "integrity": "sha512-5KZhdJj2kzlSvtP7/uTCs0rV4mTrghsCphEQc7YlDKC0+Ipq597j9K6yN9dMB/AFUK1qEOC098F0VEpVTtQGtw==", "hasInstallScript": true, "dependencies": { - "@codingame/monaco-vscode-languages-service-override": "~1.82.4", - "@codingame/monaco-vscode-model-service-override": "~1.82.4", + "@codingame/monaco-vscode-editor-service-override": "~1.82.5", + "@codingame/monaco-vscode-languages-service-override": "~1.82.5", + "@codingame/monaco-vscode-model-service-override": "~1.82.5", "monaco-editor": "~0.43.0", - "vscode": "npm:@codingame/monaco-vscode-api@>=1.82.4 <1.83.0", - "vscode-jsonrpc": "~8.1.0", + "vscode": "npm:@codingame/monaco-vscode-api@>=1.82.5 <1.83.0", "vscode-languageclient": "~8.1.0" }, "engines": { @@ -4879,7 +4859,7 @@ }, "peerDependencies": { "monaco-editor": "~0.43.0", - "vscode": "npm:@codingame/monaco-vscode-api@>=1.82.4 <1.83.0" + "vscode": "npm:@codingame/monaco-vscode-api@>=1.82.5 <1.83.0" }, "peerDependenciesMeta": { "monaco-editor": { @@ -4891,33 +4871,55 @@ } }, "node_modules/monaco-languageclient-examples": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/monaco-languageclient-examples/-/monaco-languageclient-examples-6.5.2.tgz", - "integrity": "sha512-I1i7CYAIMU8hBAD5QUCm5DN3bJo39uJi3mwvMvc2UUfjFmBMeyADigKKv4oDn3GOav3JARyLnedXVOPMBNoMmA==", - "dependencies": { - "@codingame/monaco-vscode-configuration-service-override": "~1.82.4", - "@codingame/monaco-vscode-editor-service-override": "~1.82.4", - "@codingame/monaco-vscode-json-default-extension": "~1.82.4", - "@codingame/monaco-vscode-keybindings-service-override": "~1.82.4", - "@codingame/monaco-vscode-python-default-extension": "~1.82.4", - "@codingame/monaco-vscode-textmate-service-override": "~1.82.4", - "@codingame/monaco-vscode-theme-defaults-default-extension": "~1.82.4", - "@codingame/monaco-vscode-theme-service-override": "~1.82.4", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/monaco-languageclient-examples/-/monaco-languageclient-examples-6.5.3.tgz", + "integrity": "sha512-NFWRFgvTAsvx1Sek79RHtvBYOA2/HqGXfl7hmWjeGmfPySdELleVh3QbO0xNZ1dFLroLQPOgaVjX0I4qsiN2FA==", + "dependencies": { + "@codingame/monaco-vscode-configuration-service-override": "~1.82.5", + "@codingame/monaco-vscode-editor-service-override": "~1.82.5", + "@codingame/monaco-vscode-files-service-override": "~1.82.5", + "@codingame/monaco-vscode-json-default-extension": "~1.82.5", + "@codingame/monaco-vscode-keybindings-service-override": "~1.82.5", + "@codingame/monaco-vscode-python-default-extension": "~1.82.5", + "@codingame/monaco-vscode-textmate-service-override": "~1.82.5", + "@codingame/monaco-vscode-theme-defaults-default-extension": "~1.82.5", + "@codingame/monaco-vscode-theme-service-override": "~1.82.5", "express": "~4.18.2", "langium": "~2.0.2", "langium-statemachine-dsl": "~2.0.0", "monaco-editor-workers": "~0.43.0", - "monaco-languageclient": "~6.5.2", + "monaco-languageclient": "~6.5.3", "pyright": "~1.1.330", "react": "~18.2.0", "react-dom": "~18.2.0", "request-light": "~0.7.0", "vscode-json-languageservice": "~5.3.6", "vscode-languageserver": "~8.1.0", + "vscode-uri": "~3.0.8", "vscode-ws-jsonrpc": "~3.0.0", "ws": "~8.14.2" } }, + "node_modules/monaco-languageclient-examples/node_modules/ws": { + "version": "8.14.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz", + "integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==", + "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/mrmime": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz", @@ -5366,6 +5368,14 @@ "node": ">= 0.12.0" } }, + "node_modules/portfinder/node_modules/async": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", + "dependencies": { + "lodash": "^4.17.14" + } + }, "node_modules/portfinder/node_modules/debug": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", @@ -5607,27 +5617,6 @@ "node": ">= 14" } }, - "node_modules/puppeteer-core/node_modules/ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", - "dev": true, - "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/pyright": { "version": "1.1.330", "resolved": "https://registry.npmjs.org/pyright/-/pyright-1.1.330.tgz", @@ -6099,9 +6088,23 @@ "dev": true }, "node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] }, "node_modules/safer-buffer": { "version": "2.1.2", @@ -6482,26 +6485,6 @@ "safe-buffer": "~5.2.0" } }, - "node_modules/string_decoder/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -6907,6 +6890,12 @@ "util-deprecate": "~1.0.1" } }, + "node_modules/unzipper/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, "node_modules/unzipper/node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -7136,9 +7125,9 @@ }, "node_modules/vscode": { "name": "@codingame/monaco-vscode-api", - "version": "1.82.4", - "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-api/-/monaco-vscode-api-1.82.4.tgz", - "integrity": "sha512-hyqKIlucXSmT2YRgQPdfo6rchDPG8W3S2rSvRtrzQRBdLgbzjPf8p5yEcMDWrry3YQgFvVzPCIs81W7052JeUQ==", + "version": "1.82.5", + "resolved": "https://registry.npmjs.org/@codingame/monaco-vscode-api/-/monaco-vscode-api-1.82.5.tgz", + "integrity": "sha512-FkIETLRm2BrjOraRuM+VcTcDkvf59TVLfRfj9wUUbK/i9Zm/yof6RQZSXaPTf9ECC6effg0CBd0VmM2zIeVxWg==", "dependencies": { "monaco-editor": "0.43.0" }, @@ -7513,9 +7502,10 @@ "dev": true }, "node_modules/ws": { - "version": "8.14.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz", - "integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "dev": true, "engines": { "node": ">=10.0.0" }, @@ -7622,20 +7612,18 @@ "name": "monaco-editor-wrapper-examples", "version": "0.0.0", "dependencies": { - "@codingame/monaco-vscode-configuration-service-override": "~1.82.4", - "@codingame/monaco-vscode-editor-service-override": "~1.82.4", - "@codingame/monaco-vscode-json-default-extension": "~1.82.4", - "@codingame/monaco-vscode-keybindings-service-override": "~1.82.4", - "@codingame/monaco-vscode-python-default-extension": "~1.82.4", - "@codingame/monaco-vscode-textmate-service-override": "~1.82.4", - "@codingame/monaco-vscode-theme-defaults-default-extension": "~1.82.4", - "@codingame/monaco-vscode-theme-service-override": "~1.82.4", - "@typefox/monaco-editor-react": "~2.2.5", + "@codingame/monaco-vscode-configuration-service-override": "~1.82.5", + "@codingame/monaco-vscode-editor-service-override": "~1.82.5", + "@codingame/monaco-vscode-json-default-extension": "~1.82.5", + "@codingame/monaco-vscode-keybindings-service-override": "~1.82.5", + "@codingame/monaco-vscode-python-default-extension": "~1.82.5", + "@typefox/monaco-editor-react": "~2.3.0-next.3", "http-server": "~14.1.1", "langium": "~2.0.2", "langium-statemachine-dsl": "~2.0.0", "monaco-editor-workers": "~0.43.0", - "monaco-languageclient-examples": "~6.5.2", + "monaco-editor-wrapper": "~3.3.0-next.3", + "monaco-languageclient-examples": "~6.5.3", "react": "~18.2.0", "react-dom": "~18.2.0", "request-light": "~0.7.0", @@ -7652,28 +7640,31 @@ }, "packages/monaco-editor-react": { "name": "@typefox/monaco-editor-react", - "version": "2.2.5", + "version": "2.3.0-next.3", "license": "MIT", "devDependencies": { "@types/react": "~18.2.23", "@types/react-dom": "~18.2.8" }, "peerDependencies": { - "monaco-editor-wrapper": "~3.2.5", + "monaco-editor-wrapper": "~3.3.0-next.3", "react": "~18.2.0", "react-dom": "~18.2.0" } }, "packages/monaco-editor-wrapper": { - "version": "3.2.5", + "version": "3.3.0-next.3", "license": "MIT", "dependencies": { - "@codingame/monaco-vscode-configuration-service-override": "~1.82.4", - "@codingame/monaco-vscode-editor-service-override": "~1.82.4", - "monaco-languageclient": "~6.5.2" + "@codingame/monaco-vscode-configuration-service-override": "~1.82.5", + "@codingame/monaco-vscode-editor-service-override": "~1.82.5", + "@codingame/monaco-vscode-textmate-service-override": "~1.82.5", + "@codingame/monaco-vscode-theme-defaults-default-extension": "~1.82.5", + "@codingame/monaco-vscode-theme-service-override": "~1.82.5", + "monaco-languageclient": "~6.5.3" }, "peerDependencies": { - "monaco-languageclient": "~6.5.2", + "monaco-languageclient": "~6.5.3", "vscode-ws-jsonrpc": "~3.0.0" } } diff --git a/packages/examples/CHANGELOG.md b/packages/examples/CHANGELOG.md index 7d2c3be..3ecc508 100644 --- a/packages/examples/CHANGELOG.md +++ b/packages/examples/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this npm module are documented in this file. +## 2023-10-1x + +- Adjust to underlying api changes (`monaco-vscode-api` and `monaco-languageclient`) + - Renamed `EditorAppVscodeApi` to `EditorAppExtended` and `EditorAppConfigVscodeApi` to `EditorAppConfigExtended` + - BREAKING: `$type` of `EditorAppConfigExtended` was changed from `vscodeApi` to `extended` +- Fix json language server launch +- Move python language server port to 30001 and json language server port to 30000 + ## 2023-09-21 - Langium example allows to use semantic highlighting with monarch grammars (monaco-editor classic mode) diff --git a/packages/examples/package.json b/packages/examples/package.json index 298f948..61eb400 100644 --- a/packages/examples/package.json +++ b/packages/examples/package.json @@ -4,20 +4,18 @@ "version": "0.0.0", "type": "module", "dependencies": { - "@codingame/monaco-vscode-editor-service-override": "~1.82.4", - "@codingame/monaco-vscode-configuration-service-override": "~1.82.4", - "@codingame/monaco-vscode-json-default-extension": "~1.82.4", - "@codingame/monaco-vscode-keybindings-service-override": "~1.82.4", - "@codingame/monaco-vscode-python-default-extension": "~1.82.4", - "@codingame/monaco-vscode-textmate-service-override": "~1.82.4", - "@codingame/monaco-vscode-theme-defaults-default-extension": "~1.82.4", - "@codingame/monaco-vscode-theme-service-override": "~1.82.4", - "@typefox/monaco-editor-react": "~2.2.5", + "@codingame/monaco-vscode-configuration-service-override": "~1.82.5", + "@codingame/monaco-vscode-editor-service-override": "~1.82.5", + "@codingame/monaco-vscode-json-default-extension": "~1.82.5", + "@codingame/monaco-vscode-keybindings-service-override": "~1.82.5", + "@codingame/monaco-vscode-python-default-extension": "~1.82.5", + "@typefox/monaco-editor-react": "~2.3.0-next.3", "http-server": "~14.1.1", "langium": "~2.0.2", "langium-statemachine-dsl": "~2.0.0", - "monaco-languageclient-examples": "~6.5.2", + "monaco-languageclient-examples": "~6.5.3", "monaco-editor-workers": "~0.43.0", + "monaco-editor-wrapper": "~3.3.0-next.3", "react": "~18.2.0", "react-dom": "~18.2.0", "request-light": "~0.7.0", diff --git a/packages/examples/src/langium/config/wrapperLangiumClassic.ts b/packages/examples/src/langium/config/wrapperLangiumClassic.ts index 49ad413..ff6bd77 100644 --- a/packages/examples/src/langium/config/wrapperLangiumClassic.ts +++ b/packages/examples/src/langium/config/wrapperLangiumClassic.ts @@ -32,16 +32,11 @@ export const setupLangiumClientClassic = async (): Promise => { code: code, useDiffEditor: false, theme: 'vs-dark', - // configure it like this or in the userConfiguration editorOptions: { 'semanticHighlighting.enabled': true }, languageExtensionConfig: { id: 'langium' }, languageDef: LangiumMonarchContent, - userConfiguration: { - // or configure the semantic highlighting like this: - // `{ json: "editor.semanticHighlighting.enabled": true }` - } } }, languageClientConfig: { diff --git a/packages/examples/src/langium/config/wrapperLangiumVscode.ts b/packages/examples/src/langium/config/wrapperLangiumExtended.ts similarity index 77% rename from packages/examples/src/langium/config/wrapperLangiumVscode.ts rename to packages/examples/src/langium/config/wrapperLangiumExtended.ts index a95792f..cbd0ada 100644 --- a/packages/examples/src/langium/config/wrapperLangiumVscode.ts +++ b/packages/examples/src/langium/config/wrapperLangiumExtended.ts @@ -1,16 +1,11 @@ -import { Uri } from 'vscode'; -import getConfigurationServiceOverride from '@codingame/monaco-vscode-configuration-service-override'; import getEditorServiceOverride from '@codingame/monaco-vscode-editor-service-override'; import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override'; -import getThemeServiceOverride from '@codingame/monaco-vscode-theme-service-override'; -import getTextmateServiceOverride from '@codingame/monaco-vscode-textmate-service-override'; -import { whenReady as whenReadyThemes } from '@codingame/monaco-vscode-theme-defaults-default-extension'; import { useOpenEditorStub } from 'monaco-languageclient'; import { UserConfig } from 'monaco-editor-wrapper'; import { getTextContent } from '../../common.js'; import { loadLangiumWorker } from '../wrapperLangium.js'; -export const setupLangiumClientVscodeApi = async (): Promise => { +export const setupLangiumClientExtended = async (): Promise => { const code = await getTextContent(new URL('./src/langium/content/example.langium', window.location.href)); const extensionFilesOrContents = new Map(); @@ -25,21 +20,16 @@ export const setupLangiumClientVscodeApi = async (): Promise => { wrapperConfig: { serviceConfig: { userServices: { - ...getThemeServiceOverride(), - ...getTextmateServiceOverride(), - ...getConfigurationServiceOverride(Uri.file('/workspace')), ...getEditorServiceOverride(useOpenEditorStub), ...getKeybindingsServiceOverride() }, debugLogging: true }, editorAppConfig: { - $type: 'vscodeApi', + $type: 'extended', languageId: 'langium', code: code, useDiffEditor: false, - // Ensure all required extensions are loaded before setting up the language extension - awaitExtensionReadiness: [whenReadyThemes], extensions: [{ config: { name: 'langium-example', diff --git a/packages/examples/src/langium/config/wrapperStatemachineConfig.ts b/packages/examples/src/langium/config/wrapperStatemachineConfig.ts index a330d7f..f779376 100644 --- a/packages/examples/src/langium/config/wrapperStatemachineConfig.ts +++ b/packages/examples/src/langium/config/wrapperStatemachineConfig.ts @@ -1,10 +1,5 @@ -import getConfigurationServiceOverride from '@codingame/monaco-vscode-configuration-service-override'; import getEditorServiceOverride from '@codingame/monaco-vscode-editor-service-override'; import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override'; -import getThemeServiceOverride from '@codingame/monaco-vscode-theme-service-override'; -import getTextmateServiceOverride from '@codingame/monaco-vscode-textmate-service-override'; -import { whenReady as whenReadyThemes } from '@codingame/monaco-vscode-theme-defaults-default-extension'; -import { Uri } from 'vscode'; import { useOpenEditorStub } from 'monaco-languageclient'; import { UserConfig } from 'monaco-editor-wrapper'; import { loadStatemachinWorker } from '../wrapperStatemachine.js'; @@ -25,21 +20,16 @@ export const createLangiumGlobalConfig = async (): Promise => { wrapperConfig: { serviceConfig: { userServices: { - ...getThemeServiceOverride(), - ...getTextmateServiceOverride(), - ...getConfigurationServiceOverride(Uri.file('/workspace')), ...getEditorServiceOverride(useOpenEditorStub), ...getKeybindingsServiceOverride() }, debugLogging: true }, editorAppConfig: { - $type: 'vscodeApi', + $type: 'extended', languageId: 'statemachine', code: code, useDiffEditor: false, - // Ensure all required extensions are loaded before setting up the language extension - awaitExtensionReadiness: [whenReadyThemes], extensions: [{ config: { name: 'statemachine-example', diff --git a/packages/examples/src/langium/wrapperLangium.ts b/packages/examples/src/langium/wrapperLangium.ts index dc9efe3..9230206 100644 --- a/packages/examples/src/langium/wrapperLangium.ts +++ b/packages/examples/src/langium/wrapperLangium.ts @@ -4,7 +4,7 @@ * ------------------------------------------------------------------------------------------ */ import { MonacoEditorLanguageClientWrapper } from 'monaco-editor-wrapper'; -import { setupLangiumClientVscodeApi } from './config/wrapperLangiumVscode.js'; +import { setupLangiumClientExtended } from './config/wrapperLangiumExtended.js'; import { setupLangiumClientClassic } from './config/wrapperLangiumClassic.js'; import { buildWorkerDefinition } from 'monaco-editor-workers'; @@ -16,17 +16,18 @@ const htmlElement = document.getElementById('monaco-editor-root'); export const run = async () => { try { document.querySelector('#button-start-classic')?.addEventListener('click', startLangiumClientClassic); - document.querySelector('#button-start-vscode-api')?.addEventListener('click', startLangiumClientVscodeApi); + document.querySelector('#button-start-extended')?.addEventListener('click', startLangiumClientExtended); document.querySelector('#button-dispose')?.addEventListener('click', disposeEditor); } catch (e) { console.error(e); } }; -export const startLangiumClientVscodeApi = async () => { +export const startLangiumClientExtended = async () => { try { if (checkStarted()) return; - const config = await setupLangiumClientVscodeApi(); + disableButton('button-start-classic'); + const config = await setupLangiumClientExtended(); wrapper = new MonacoEditorLanguageClientWrapper(); wrapper.start(config, htmlElement); } catch (e) { @@ -37,6 +38,7 @@ export const startLangiumClientVscodeApi = async () => { export const startLangiumClientClassic = async () => { try { if (checkStarted()) return; + disableButton('button-start-extended'); const config = await setupLangiumClientClassic(); wrapper = new MonacoEditorLanguageClientWrapper(); await wrapper.start(config, htmlElement!); @@ -53,6 +55,13 @@ const checkStarted = () => { return false; }; +const disableButton = (id: string) => { + const button = document.getElementById(id) as HTMLButtonElement; + if (button !== null) { + button.disabled = true; + } +}; + export const disposeEditor = async () => { if (!wrapper) return; wrapper.reportStatus(); diff --git a/packages/examples/src/reactPython.tsx b/packages/examples/src/reactPython.tsx index 3af279f..dda7d2d 100644 --- a/packages/examples/src/reactPython.tsx +++ b/packages/examples/src/reactPython.tsx @@ -1,8 +1,4 @@ -import getConfigurationServiceOverride from '@codingame/monaco-vscode-configuration-service-override'; import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override'; -import getThemeServiceOverride from '@codingame/monaco-vscode-theme-service-override'; -import getTextmateServiceOverride from '@codingame/monaco-vscode-textmate-service-override'; -import { whenReady as whenReadyThemes } from '@codingame/monaco-vscode-theme-defaults-default-extension'; import { whenReady as whenReadyPython } from '@codingame/monaco-vscode-python-default-extension'; import React from 'react'; import ReactDOM from 'react-dom/client'; @@ -27,7 +23,7 @@ const userConfig: UserConfig = { name: 'Python Language Server Example', $type: 'WebSocket', host: 'localhost', - port: 30000, + port: 30001, path: 'pyright', extraParams: { authorization: 'UserAuth' @@ -56,18 +52,15 @@ const userConfig: UserConfig = { wrapperConfig: { serviceConfig: { userServices: { - ...getThemeServiceOverride(), - ...getTextmateServiceOverride(), - ...getConfigurationServiceOverride(Uri.file('/workspace')), ...getKeybindingsServiceOverride() }, debugLogging: true }, editorAppConfig: { - $type: 'vscodeApi', + $type: 'extended', languageId: 'python', codeUri: '/workspace/python.py', - awaitExtensionReadiness: [whenReadyThemes, whenReadyPython], + awaitExtensionReadiness: [whenReadyPython], extensions: [{ config: { name: 'python-client', diff --git a/packages/examples/src/servers/json-server.ts b/packages/examples/src/servers/json-server.ts index 4fbe659..2bb7759 100644 --- a/packages/examples/src/servers/json-server.ts +++ b/packages/examples/src/servers/json-server.ts @@ -1,3 +1,6 @@ -import { runJsonServer } from 'monaco-languageclient-examples/node'; +import { resolve } from 'path'; +import { getLocalDirectory, runJsonServer } from 'monaco-languageclient-examples/node'; -runJsonServer(); +const baseDir = resolve(getLocalDirectory(import.meta.url)); +const relativeDir = '../../../../node_modules/monaco-languageclient-examples/dist/json/server/json-server.js'; +runJsonServer(baseDir, relativeDir); diff --git a/packages/examples/src/wrapperAdvanced.ts b/packages/examples/src/wrapperAdvanced.ts index 2dc1ea3..dcb4319 100644 --- a/packages/examples/src/wrapperAdvanced.ts +++ b/packages/examples/src/wrapperAdvanced.ts @@ -37,7 +37,7 @@ Same again.` $type: 'WebSocket', name: 'wrapper42 language client', host: 'localhost', - port: 3000, + port: 30000, path: 'sampleServer', secured: false } diff --git a/packages/examples/src/wrapperTs.ts b/packages/examples/src/wrapperTs.ts index 30571e8..2efce35 100644 --- a/packages/examples/src/wrapperTs.ts +++ b/packages/examples/src/wrapperTs.ts @@ -41,7 +41,7 @@ const userConfig: UserConfig = { editorAppConfig: { $type: 'classic', languageId: 'typescript', - code: code, + code, codeUri: codeUri, codeOriginal: codeOriginal, useDiffEditor: false, diff --git a/packages/examples/src/wrapperWs.ts b/packages/examples/src/wrapperWs.ts index 47ffd36..6778989 100644 --- a/packages/examples/src/wrapperWs.ts +++ b/packages/examples/src/wrapperWs.ts @@ -1,7 +1,4 @@ import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override'; -import getThemeServiceOverride from '@codingame/monaco-vscode-theme-service-override'; -import getTextmateServiceOverride from '@codingame/monaco-vscode-textmate-service-override'; -import { whenReady as whenReadyTheme } from '@codingame/monaco-vscode-theme-defaults-default-extension'; import { whenReady as whenReadyJson } from '@codingame/monaco-vscode-json-default-extension'; import { disposeEditor, startEditor, swapEditors } from './common.js'; import { UserConfig } from 'monaco-editor-wrapper'; @@ -19,49 +16,35 @@ const codeOrg = `{ "line_endings": {"value": "unix"} }`; -const monacoEditorConfig = { - glyphMargin: true, - guides: { - bracketPairs: true - }, - lightbulb: { - enabled: true - }, -}; - const userConfig: UserConfig = { wrapperConfig: { serviceConfig: { userServices: { - ...getThemeServiceOverride(), - ...getTextmateServiceOverride(), ...getKeybindingsServiceOverride(), }, debugLogging: true }, editorAppConfig: { - $type: 'classic', + $type: 'extended', languageId: languageId, code: codeMain, useDiffEditor: false, codeOriginal: codeOrg, - editorOptions: monacoEditorConfig, - diffEditorOptions: monacoEditorConfig, - theme: 'vs-dark', // Ensure all required extensions are loaded before setting up the language extension - awaitExtensionReadiness: [whenReadyTheme, whenReadyJson], - languageExtensionConfig: { - id: 'json', - extensions: ['.json', '.jsonc'], - aliases: ['JSON', 'json'], - mimetypes: ['application/json'] + awaitExtensionReadiness: [whenReadyJson], + userConfiguration: { + json: JSON.stringify({ + 'workbench.colorTheme': 'Default Dark Modern', + 'editor.guides.bracketPairsHorizontal': 'active', + 'editor.lightbulb.enabled': true + }) } } }, languageClientConfig: { options: { $type: 'WebSocketUrl', - url: 'ws://localhost:3000/sampleServer', + url: 'ws://localhost:30000/sampleServer', startOptions: { onCall: () => { console.log('Connected to socket.'); diff --git a/packages/examples/wrapper_langium.html b/packages/examples/wrapper_langium.html index 81fbdb9..0f8c75a 100644 --- a/packages/examples/wrapper_langium.html +++ b/packages/examples/wrapper_langium.html @@ -11,7 +11,7 @@

Langium Grammar DSL Language Client & Server (Worker)

- +
diff --git a/packages/monaco-editor-react/CHANGELOG.md b/packages/monaco-editor-react/CHANGELOG.md index dcab5f9..9b726c5 100644 --- a/packages/monaco-editor-react/CHANGELOG.md +++ b/packages/monaco-editor-react/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to npm module [@typefox/monaco-editor-react](https://www.npmjs.com/package/@typefox/monaco-editor-react) are documented in this file. +## [2.3.0] - 2023-10-1y + +- Properly separate and define classic and extended editor [#54](https://github.com/TypeFox/monaco-components/pull/54) + - Renamed `EditorAppVscodeApi` to `EditorAppExtended` and `EditorAppConfigVscodeApi` to `EditorAppConfigExtended` + - BREAKING: `$type` of `EditorAppConfigExtended` was changed from `vscodeApi` to `extended` +- Updated to `monaco-editor-wrapper` `3.3.0` + ## [2.2.5] - 2023-10-13 - Updated to `monaco-editor-wrapper` `3.2.5` diff --git a/packages/monaco-editor-react/README.md b/packages/monaco-editor-react/README.md index 83d3c1e..7608b2b 100644 --- a/packages/monaco-editor-react/README.md +++ b/packages/monaco-editor-react/README.md @@ -64,7 +64,7 @@ import { MonacoEditorReactComp } from '@typefox/monaco-editor-react/bundle'; These are the examples specifically for `@typefox/monaco-editor-react` that you can find in the repository: -- TypeScript editor worker using classical configuration [see](../examples/react_ts.html) +- TypeScript editor worker using classic configuration [see](../examples/react_ts.html) - Langium statemachine language client and web worker based language server using the exact same user configuration as [wrapper statemachine](../examples/wrapper_statemachine.html), [see](../examples/react_statemachine.html) - Langium grammar language client and web worker based language server using vscode-api configuration [see](../examples/react_langium.html) diff --git a/packages/monaco-editor-react/package.json b/packages/monaco-editor-react/package.json index c4f6a83..d1dc4ed 100644 --- a/packages/monaco-editor-react/package.json +++ b/packages/monaco-editor-react/package.json @@ -1,6 +1,6 @@ { "name": "@typefox/monaco-editor-react", - "version": "2.2.5", + "version": "2.3.0-next.3", "license": "MIT", "description": "React component for Monaco-Editor and Monaco Languageclient", "keywords": [ @@ -50,7 +50,7 @@ "npm": "9.8.1" }, "peerDependencies": { - "monaco-editor-wrapper": "~3.2.5", + "monaco-editor-wrapper": "~3.3.0-next.3", "react": "~18.2.0", "react-dom": "~18.2.0" }, diff --git a/packages/monaco-editor-react/src/index.tsx b/packages/monaco-editor-react/src/index.tsx index a15b674..fe5dc6a 100644 --- a/packages/monaco-editor-react/src/index.tsx +++ b/packages/monaco-editor-react/src/index.tsx @@ -1,4 +1,4 @@ -import { EditorAppClassic, MonacoEditorLanguageClientWrapper, UserConfig, WorkerConfigDirect, WorkerConfigOptions, isAppConfigDifferent } from 'monaco-editor-wrapper'; +import { EditorAppClassic, EditorAppExtended, MonacoEditorLanguageClientWrapper, UserConfig, WorkerConfigDirect, WorkerConfigOptions } from 'monaco-editor-wrapper'; import { IDisposable } from 'monaco-editor'; import * as vscode from 'vscode'; import React, { CSSProperties } from 'react'; @@ -41,6 +41,8 @@ export class MonacoEditorReactComp extends React.Component { } let mustReInit = false; + const prevConfig = prevProps.userConfig.wrapperConfig.editorAppConfig; + const config = userConfig.wrapperConfig.editorAppConfig; const prevWorkerOptions = prevProps.userConfig.languageClientConfig?.options; const currentWorkerOptions = userConfig.languageClientConfig?.options; const prevIsWorker = (prevWorkerOptions?.$type === 'WorkerDirect'); @@ -59,26 +61,21 @@ export class MonacoEditorReactComp extends React.Component { mustReInit = true; } + if (prevConfig.$type === 'classic' && config.$type === 'classic') { + mustReInit = (wrapper?.getMonacoEditorApp() as EditorAppClassic).isAppConfigDifferent(prevConfig, config, false) === true; + } else if (prevConfig.$type === 'extended' && config.$type === 'extended') { + mustReInit = (wrapper?.getMonacoEditorApp() as EditorAppExtended).isAppConfigDifferent(prevConfig, config, false) === true; + } + if (mustReInit) { await this.handleReinit(); } else { - if (wrapper !== null) { - const prevConfig = prevProps.userConfig.wrapperConfig.editorAppConfig; - const config = userConfig.wrapperConfig.editorAppConfig; - const appConfigDifferent = isAppConfigDifferent(prevConfig, config, false, false); - - // we need to restart if the editor wrapper config changed - if (appConfigDifferent) { - await this.handleReinit(); - } else { - // the function now ensure a model update is only required if something else than the code changed - this.wrapper.updateModel(userConfig.wrapperConfig.editorAppConfig); - - if (prevConfig.$type === 'classic' && config.$type === 'classic') { - if (prevConfig.editorOptions !== config.editorOptions) { - (wrapper.getMonacoEditorApp() as EditorAppClassic).updateMonacoEditorOptions(config.editorOptions ?? {}); - } - } + // the function now ensure a model update is only required if something else than the code changed + this.wrapper.updateModel(userConfig.wrapperConfig.editorAppConfig); + + if (prevConfig.$type === 'classic' && config.$type === 'classic') { + if (prevConfig.editorOptions !== config.editorOptions) { + (wrapper.getMonacoEditorApp() as EditorAppClassic).updateMonacoEditorOptions(config.editorOptions ?? {}); } } } diff --git a/packages/monaco-editor-wrapper/CHANGELOG.md b/packages/monaco-editor-wrapper/CHANGELOG.md index 5b72a81..c9ad42e 100644 --- a/packages/monaco-editor-wrapper/CHANGELOG.md +++ b/packages/monaco-editor-wrapper/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to npm module [monaco-editor-wrapper](https://www.npmjs.com/package/monaco-editor-wrapper) are documented in this file. +## [2.3.0] - 2023-10-1y + +- Properly separate and define classic and extended editor [#54](https://github.com/TypeFox/monaco-components/pull/54) + - Renamed `EditorAppVscodeApi` to `EditorAppExtended` and `EditorAppConfigVscodeApi` to `EditorAppConfigExtended` + - BREAKING: `$type` of `EditorAppConfigExtended` was changed from `vscodeApi` to `extended` +- Updated to `monaco-languageclient@6.5.3` + ## [3.2.5] - 2023-10-13 - New Problem in vite [#55](https://github.com/TypeFox/monaco-components/issues/55) @@ -76,7 +83,7 @@ All notable changes to npm module [monaco-editor-wrapper](https://www.npmjs.com/ - Use global configuration object that is passed to the wrapper on start - The `monaco-editor-wrapper` and the new `@typefox/monaco-editor-react` component use the same configuration - The underlying monaco-editor can be configured in two ways now (wrapperConfig): - - Classical: As before, but with one config object + - Classic: As before, but with one config object - Extension like: Using the extension based mechanism supplied by `monaco-vscode-api` - `monaco-languageclient` no longer exposes its own service. Now, we fully rely on services supplied by `monaco-vscode-api` - This means even if you decide to configure monaco-editor the classical way, you still require some basic services. This configuration is made inside `MonacoEditorLanguageClientWrapper`. Potential serviceConfig supplied when using vscode-api extension config is taken into account and combined then. diff --git a/packages/monaco-editor-wrapper/README.md b/packages/monaco-editor-wrapper/README.md index 5d03bf9..ed9bbe1 100644 --- a/packages/monaco-editor-wrapper/README.md +++ b/packages/monaco-editor-wrapper/README.md @@ -16,18 +16,44 @@ npm run build This will clean, compile and build a bundle of the `monaco-editor-wrapper`, which you can reference in your own projects. For examples, you can see the top-level [README](../../README.md#getting-started) with details on running a local dev instance. ## Configuration -s -With release 2.0.0, the configuration approach is completely revised. -The `UserConfig` now contains everything and is passed to the `start` function of the wrapper. Because [monaco-vscode-api](https://github.com/CodinGame/monaco-vscode-api) uses a VS Code extension like configuration approach, the `UserConfig` allows to configure monaco-editor the [classical way](./src/editorAppClassic.ts) or to use [monaco-vscode-api way](./src/editorAppVscodeApi.ts). Additionally, [monaco-vscode-api](https://github.com/CodinGame/monaco-vscode-api) brings VS Code services to monaco-editor it usually does not have (Textmate Support, VS Code Theme Support, Keybindings, etc.). The wrapper initializes the following services from monaco-vscode-api independent of the editor mode: *model*, *editor* and *configuration*. +With release >2.0.0, the configuration approach is completely revised. + +The `UserConfig` now contains everything and is passed to the `start` function of the wrapper along with the HTML element `monaco-editor` is bound to. + +[@codingame/monaco-vscode-api](https://github.com/CodinGame/monaco-vscode-api) implements the VSCode api and redirects calls to `monaco-editor`. It allows to add serivccs that are usually only available in VSCode and not with pure `monaco-editor`. + `UserConfig` allows two possible configuration modes: + +- **Classic**: Configure `monaco-editor` as you would when using it directly, [see](./src/editorAppClassic.ts) +- **Extended**: Configure `monaco-editor` like a VSCode extension, [see](./src/editorAppExtended.ts) + +[This](https://github.com/CodinGame/monaco-vscode-api#monaco-standalone-services) is the list of services defined by [@codingame/monaco-vscode-api](https://github.com/CodinGame/monaco-vscode-api). +The following services are enabled by default in both editor modes: + +- layout +- environment +- extension +- files +- quickAccess +- languages +- model +- configuration + +**Extended** mode adds the following and thereby disables monarch grammars: + +- theme +- textmate + +If you want any further services than the ones initialized by default, you should use the **extended** mode as some service (like *theme* and *textmate*) are incompatible with the **classic** mode. + +Monarch grammars and themes can only be used in **classic** mode and textmate grammars and themes can only be used in **extended** mode. ## Usage -Monaco Editor with TypeScript language support in web worker and relying on regular monaco-editor configuration: +Monaco Editor with TypeScript language support in web worker and relying on classic mode: -```typescript +```ts import { MonacoEditorLanguageClientWrapper, UserConfig } from 'monaco-editor-wrapper'; - import 'monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution.js'; import 'monaco-editor/esm/vs/language/typescript/monaco.contribution.js'; @@ -38,21 +64,22 @@ buildWorkerDefinition('./node_modules/monaco-editor-workers/dist/workers', impor // no top-level await const run = async () => { const wrapper = new MonacoEditorLanguageClientWrapper(); + const code: `function sayHello(): string { + return "Hello"; +};`, const userConfig = { - htmlElement: document.getElementById('monaco-editor-root') as HTMLElement, - // rely on regular monaco-editor configuration wrapperConfig: { editorAppConfig: { $type: 'classic', languageId: 'typescript', - code: `function sayHello(): string { - return "Hello"; -};`, + code, useDiffEditor: false, } } }; - await wrapper.start(userConfig); + + const htmlElement = document.getElementById('monaco-editor-root'); + await wrapper.start(userConfig, htmlElement); } ``` @@ -60,8 +87,8 @@ const run = async () => { These are the examples specifically for `monaco-editor-wrapper` you find in the repository: -- TypeScript editor worker using classical configuration, [see](../examples/wrapper_ts.html) -- Language client & web socket language server example using vscode-api configuration [see](../examples/wrapper_ws.html) It requires the json language server to run. Use `start:server:json` from [here](../examples/package.json) -- Multiple editors using classical configuration [see](../examples/wrapper_adv.html) -- Langium statemachine language client and web worker based language server using vscode-api configuration [see](../examples/wrapper_statemachine.html) -- Langium grammar language client and web worker based language server using vscode-api configuration [see](../examples/wrapper_langium.html) +- TypeScript editor worker using classic mode, [see](../examples/wrapper_ts.html) +- Language client & web socket language server example using extended mode [see](../examples/wrapper_ws.html) It requires the json language server to run. Use `start:server:json` from [here](../examples/package.json) +- Multiple editors using classic mode [see](../examples/wrapper_adv.html) +- Langium statemachine language client and web worker based language server using extended mode [see](../examples/wrapper_statemachine.html) +- Langium grammar language client and web worker based language server allowing to choose classic or extended mode [see](../examples/wrapper_langium.html) diff --git a/packages/monaco-editor-wrapper/package.json b/packages/monaco-editor-wrapper/package.json index 39e9dcc..e43c122 100644 --- a/packages/monaco-editor-wrapper/package.json +++ b/packages/monaco-editor-wrapper/package.json @@ -1,6 +1,6 @@ { "name": "monaco-editor-wrapper", - "version": "3.2.5", + "version": "3.3.0-next.3", "license": "MIT", "description": "Monaco-Editor and Monaco Languageclient Wrapper", "keywords": [ @@ -34,7 +34,7 @@ "dist/index" ], "styles": [ - "styles/css" + "styles/index" ] } }, @@ -58,12 +58,15 @@ "npm": "9.8.1" }, "dependencies": { - "@codingame/monaco-vscode-editor-service-override": "~1.82.4", - "@codingame/monaco-vscode-configuration-service-override": "~1.82.4", - "monaco-languageclient": "~6.5.2" + "@codingame/monaco-vscode-configuration-service-override": "~1.82.5", + "@codingame/monaco-vscode-editor-service-override": "~1.82.5", + "@codingame/monaco-vscode-textmate-service-override": "~1.82.5", + "@codingame/monaco-vscode-theme-defaults-default-extension": "~1.82.5", + "@codingame/monaco-vscode-theme-service-override": "~1.82.5", + "monaco-languageclient": "~6.5.3" }, "peerDependencies": { - "monaco-languageclient": "~6.5.2", + "monaco-languageclient": "~6.5.3", "vscode-ws-jsonrpc": "~3.0.0" }, "repository": { diff --git a/packages/monaco-editor-wrapper/src/editorAppBase.ts b/packages/monaco-editor-wrapper/src/editorAppBase.ts index 5bb2a09..b4c757a 100644 --- a/packages/monaco-editor-wrapper/src/editorAppBase.ts +++ b/packages/monaco-editor-wrapper/src/editorAppBase.ts @@ -2,9 +2,6 @@ import { editor, Uri } from 'monaco-editor'; import { createConfiguredEditor, createConfiguredDiffEditor, createModelReference, ITextFileEditorModel } from 'vscode/monaco'; import { IReference } from '@codingame/monaco-vscode-editor-service-override'; import { updateUserConfiguration as vscodeUpdateUserConfiguration } from '@codingame/monaco-vscode-configuration-service-override'; -import { UserConfig, WrapperConfig } from './wrapper.js'; -import { EditorAppConfigClassic } from './editorAppClassic.js'; -import { EditorAppConfigVscodeApi } from './editorAppVscodeApi.js'; export type ModelUpdate = { languageId: string; @@ -14,24 +11,29 @@ export type ModelUpdate = { codeOriginalUri?: string; } -export type EditorAppBaseConfig = ModelUpdate & { +export type EditorAppType = 'extended' | 'classic'; + +export type EditorAppConfigBase = ModelUpdate & { + $type: EditorAppType; useDiffEditor: boolean; domReadOnly?: boolean; readOnly?: boolean; - awaitExtensionReadiness?: Array<() => Promise> - userConfiguration?: UserConfiguration; + awaitExtensionReadiness?: Array<() => Promise>; + overrideAutomaticLayout?: boolean; + editorOptions?: editor.IStandaloneEditorConstructionOptions; + diffEditorOptions?: editor.IStandaloneDiffEditorConstructionOptions; } -export type EditorAppType = 'vscodeApi' | 'classic'; - -export type UserConfiguration = { - json?: string; +export enum ModelUpdateType { + NONE, + CODE, + MODEL } /** * This is the base class for both Monaco Ediotor Apps: * - EditorAppClassic - * - EditorAppVscodeApi + * - EditorAppExtended * * It provides the generic functionality for both implementations. */ @@ -49,9 +51,9 @@ export abstract class EditorAppBase { this.id = id; } - protected buildConfig(userConfig: UserConfig): EditorAppBaseConfig { - const userAppConfig = userConfig.wrapperConfig.editorAppConfig; - return { + protected buildConfig(userAppConfig: EditorAppConfigBase): EditorAppConfigBase { + const config: EditorAppConfigBase = { + $type: userAppConfig.$type, languageId: userAppConfig.languageId, code: userAppConfig.code ?? '', codeOriginal: userAppConfig.codeOriginal ?? '', @@ -60,9 +62,18 @@ export abstract class EditorAppBase { codeOriginalUri: userAppConfig.codeOriginalUri ?? undefined, readOnly: userAppConfig.readOnly ?? false, domReadOnly: userAppConfig.domReadOnly ?? false, - userConfiguration: userAppConfig.userConfiguration ?? undefined, - awaitExtensionReadiness: userAppConfig.awaitExtensionReadiness ?? undefined + overrideAutomaticLayout: userAppConfig.overrideAutomaticLayout ?? true, + awaitExtensionReadiness: userAppConfig.awaitExtensionReadiness ?? undefined, + }; + config.editorOptions = { + ...userAppConfig.editorOptions, + automaticLayout: userAppConfig.overrideAutomaticLayout ?? true }; + config.diffEditorOptions = { + ...userAppConfig.diffEditorOptions, + automaticLayout: userAppConfig.overrideAutomaticLayout ?? true + }; + return config; } haveEditor() { @@ -77,14 +88,14 @@ export abstract class EditorAppBase { return this.diffEditor; } - protected async createEditor(container: HTMLElement, editorOptions?: editor.IStandaloneEditorConstructionOptions): Promise { - this.editor = createConfiguredEditor(container, editorOptions); - await this.updateEditorModel(); - } - - protected async createDiffEditor(container: HTMLElement, diffEditorOptions?: editor.IStandaloneDiffEditorConstructionOptions): Promise { - this.diffEditor = createConfiguredDiffEditor(container, diffEditorOptions); - await this.updateDiffEditorModel(); + async createEditors(container: HTMLElement): Promise { + if (this.getConfig().useDiffEditor) { + this.diffEditor = createConfiguredDiffEditor(container, this.getConfig().diffEditorOptions); + await this.updateDiffEditorModel(); + } else { + this.editor = createConfiguredEditor(container, this.getConfig().editorOptions); + await this.updateEditorModel(); + } } protected disposeEditor() { @@ -119,7 +130,7 @@ export abstract class EditorAppBase { const modelUpdateType = isModelUpdateRequired(this.getConfig(), modelUpdate); - if (modelUpdateType === ModelUpdateType.code) { + if (modelUpdateType === ModelUpdateType.CODE) { this.updateAppConfig(modelUpdate); if (this.getConfig().useDiffEditor) { this.diffEditor?.getModifiedEditor().setValue(modelUpdate.code ?? ''); @@ -127,7 +138,7 @@ export abstract class EditorAppBase { } else { this.editor.setValue(modelUpdate.code ?? ''); } - } else if (modelUpdateType === ModelUpdateType.model) { + } else if (modelUpdateType === ModelUpdateType.MODEL) { this.updateAppConfig(modelUpdate); await this.updateEditorModel(); } @@ -221,30 +232,30 @@ export abstract class EditorAppBase { return Promise.resolve(); } - async updateUserConfiguration(config?: UserConfiguration) { - if (config?.json) { - return vscodeUpdateUserConfiguration(config.json); + updateMonacoEditorOptions(options: editor.IEditorOptions & editor.IGlobalEditorOptions) { + this.getEditor()?.updateOptions(options); + } + + async updateUserConfiguration(json?: string) { + if (json) { + return vscodeUpdateUserConfiguration(json); } return Promise.resolve(); } - abstract getAppType(): string; abstract init(): Promise; - abstract createEditors(container: HTMLElement): Promise; - abstract getConfig(): EditorAppConfigClassic | EditorAppConfigVscodeApi; + abstract specifyServices(): editor.IEditorOverrideServices; + abstract getConfig(): EditorAppConfigBase; abstract disposeApp(): void; + abstract isAppConfigDifferent(orgConfig: EditorAppConfigBase, config: EditorAppConfigBase, includeModelData: boolean): boolean; } -export const isVscodeApiEditorApp = (wrapperConfig: WrapperConfig) => { - return wrapperConfig.editorAppConfig?.$type === 'vscodeApi'; -}; - -export const isCodeUpdateRequired = (config: EditorAppBaseConfig, modelUpdate: ModelUpdate) => { +export const isCodeUpdateRequired = (config: EditorAppConfigBase, modelUpdate: ModelUpdate) => { const updateRequired = (modelUpdate.code !== undefined && modelUpdate.code !== config.code) || modelUpdate.codeOriginal !== config.codeOriginal; - return updateRequired ? ModelUpdateType.code : ModelUpdateType.none; + return updateRequired ? ModelUpdateType.CODE : ModelUpdateType.NONE; }; -export const isModelUpdateRequired = (config: EditorAppBaseConfig, modelUpdate: ModelUpdate): ModelUpdateType => { +export const isModelUpdateRequired = (config: EditorAppConfigBase, modelUpdate: ModelUpdate): ModelUpdateType => { const codeUpdate = isCodeUpdateRequired(config, modelUpdate); type ModelUpdateKeys = keyof typeof modelUpdate; @@ -253,45 +264,5 @@ export const isModelUpdateRequired = (config: EditorAppBaseConfig, modelUpdate: return config[name as ModelUpdateKeys] !== modelUpdate[name as ModelUpdateKeys]; }; const updateRequired = propsModelUpdate.some(propCompare); - return updateRequired ? ModelUpdateType.model : codeUpdate; -}; - -export enum ModelUpdateType { - none, - code, - model -} - -export const isAppConfigDifferent = (orgConfig: EditorAppConfigClassic | EditorAppConfigVscodeApi, - config: EditorAppConfigClassic | EditorAppConfigVscodeApi, includeModelData: boolean, includeEditorOptions: boolean): boolean => { - - let different = includeModelData ? isModelUpdateRequired(orgConfig, config) !== ModelUpdateType.none : false; - if (orgConfig.$type === config.$type) { - - type ClassicKeys = keyof typeof orgConfig; - const propsClassic = ['useDiffEditor', 'readOnly', 'domReadOnly', 'awaitExtensionReadiness', 'userConfiguration', 'automaticLayout', 'languageDef', 'languageExtensionConfig', 'theme', 'themeData']; - const propsClassicEditorOptions = ['editorOptions', 'diffEditorOptions']; - - const propCompareClassic = (name: string) => { - return orgConfig[name as ClassicKeys] !== config[name as ClassicKeys]; - }; - - const propsVscode = ['useDiffEditor', 'readOnly', 'domReadOnly', 'awaitExtensionReadiness', 'userConfiguration', 'extensions']; - type VscodeApiKeys = keyof typeof orgConfig; - const propCompareVscodeApi = (name: string) => { - return orgConfig[name as VscodeApiKeys] !== config[name as VscodeApiKeys]; - }; - - if (orgConfig.$type === 'classic' && config.$type === 'classic') { - different = different || propsClassic.some(propCompareClassic); - if (includeEditorOptions) { - different = different || propsClassicEditorOptions.some(propCompareClassic); - } - } else if (orgConfig.$type === 'vscodeApi' && config.$type === 'vscodeApi') { - different = different || propsVscode.some(propCompareVscodeApi); - } - } else { - throw new Error('Provided configurations are not of the same type.'); - } - return different; + return updateRequired ? ModelUpdateType.MODEL : codeUpdate; }; diff --git a/packages/monaco-editor-wrapper/src/editorAppClassic.ts b/packages/monaco-editor-wrapper/src/editorAppClassic.ts index 85fb248..d84e348 100644 --- a/packages/monaco-editor-wrapper/src/editorAppClassic.ts +++ b/packages/monaco-editor-wrapper/src/editorAppClassic.ts @@ -1,28 +1,12 @@ -import { EditorAppBase, EditorAppBaseConfig, EditorAppType } from './editorAppBase.js'; import { editor, languages } from 'monaco-editor'; +import { EditorAppBase, EditorAppConfigBase, ModelUpdateType, isModelUpdateRequired } from './editorAppBase.js'; import { UserConfig } from './wrapper.js'; import { Logger } from './logger.js'; -/** - * This is derived from: - * https://microsoft.github.io/monaco-editor/api/interfaces/monaco.languages.ILanguageExtensionPoint.html - */ -export type MonacoLanguageExtensionConfig = { - id: string; - extensions?: string[]; - filenames?: string[]; - filenamePatterns?: string[]; - firstLine?: string; - aliases?: string[]; - mimetypes?: string[]; -} -export type EditorAppConfigClassic = EditorAppBaseConfig & { +export type EditorAppConfigClassic = EditorAppConfigBase & { $type: 'classic'; - automaticLayout?: boolean; theme?: editor.BuiltinTheme | string; - editorOptions?: editor.IStandaloneEditorConstructionOptions; - diffEditorOptions?: editor.IStandaloneDiffEditorConstructionOptions; - languageExtensionConfig?: MonacoLanguageExtensionConfig; + languageExtensionConfig?: languages.ILanguageExtensionPoint; languageDef?: languages.IMonarchLanguage; themeData?: editor.IStandaloneThemeData; }; @@ -32,56 +16,27 @@ export type EditorAppConfigClassic = EditorAppBaseConfig & { */ export class EditorAppClassic extends EditorAppBase { - private editorOptions: editor.IStandaloneEditorConstructionOptions; - private diffEditorOptions: editor.IStandaloneDiffEditorConstructionOptions; private config: EditorAppConfigClassic; private logger: Logger | undefined; constructor(id: string, userConfig: UserConfig, logger?: Logger) { super(id); this.logger = logger; - this.config = this.buildConfig(userConfig) as EditorAppConfigClassic; - const userInput = userConfig.wrapperConfig.editorAppConfig as EditorAppConfigClassic; + const userAppConfig = userConfig.wrapperConfig.editorAppConfig as EditorAppConfigClassic; + this.config = this.buildConfig(userAppConfig) as EditorAppConfigClassic; // default to vs-light - this.config.theme = userInput.theme ?? 'vs-light'; - // default to true - this.config.automaticLayout = userInput.automaticLayout ?? true; - - this.editorOptions = userInput.editorOptions ?? {}; - this.editorOptions.automaticLayout = userInput.automaticLayout ?? true; - - this.diffEditorOptions = userInput.diffEditorOptions ?? {}; - this.diffEditorOptions.automaticLayout = userInput.automaticLayout ?? true; - - this.config.languageExtensionConfig = userInput.languageExtensionConfig ?? undefined; - this.config.languageDef = userInput.languageDef ?? undefined; - this.config.themeData = userInput.themeData ?? undefined; - - // buildConfig ensures userConfiguration is available - if (userInput.editorOptions?.['semanticHighlighting.enabled'] !== undefined) { - if (this.config.userConfiguration === undefined) { - this.config.userConfiguration = {}; - } - const parsedUserConfig = JSON.parse(this.config.userConfiguration.json ?? '{}'); - parsedUserConfig['editor.semanticHighlighting.enabled'] = userInput.editorOptions?.['semanticHighlighting.enabled']; - this.config.userConfiguration.json = JSON.stringify(parsedUserConfig); - } - } - - getAppType(): EditorAppType { - return 'classic'; + this.config.theme = userAppConfig.theme ?? 'vs-light'; + this.config.languageExtensionConfig = userAppConfig.languageExtensionConfig ?? undefined; + this.config.languageDef = userAppConfig.languageDef ?? undefined; + this.config.themeData = userAppConfig.themeData ?? undefined; } getConfig(): EditorAppConfigClassic { return this.config; } - async createEditors(container: HTMLElement): Promise { - if (this.config.useDiffEditor) { - await this.createDiffEditor(container, this.diffEditorOptions); - } else { - await this.createEditor(container, this.editorOptions); - } + override specifyServices(): editor.IEditorOverrideServices { + return {}; } async init() { @@ -113,17 +68,32 @@ export class EditorAppClassic extends EditorAppBase { } editor.setTheme(this.config.theme!); - // buildConfig ensures userConfiguration is available - await this.updateUserConfiguration(this.config.userConfiguration); - this.logger?.info('Init of MonacoConfig was completed.'); - } - - updateMonacoEditorOptions(options: editor.IEditorOptions & editor.IGlobalEditorOptions) { - this.getEditor()?.updateOptions(options); + if (this.config.editorOptions?.['semanticHighlighting.enabled'] !== undefined) { + // use updateConfiguration here as otherwise semantic highlighting will not work + const json = JSON.stringify({ + 'editor.semanticHighlighting.enabled': this.config.editorOptions['semanticHighlighting.enabled'] + }); + await this.updateUserConfiguration(json); + } + this.logger?.info('Init of Classic App was completed.'); } disposeApp(): void { this.disposeEditor(); this.disposeDiffEditor(); } + + isAppConfigDifferent(orgConfig: EditorAppConfigClassic, config: EditorAppConfigClassic, includeModelData: boolean): boolean { + let different = false; + if (includeModelData) { + different = isModelUpdateRequired(orgConfig, config) !== ModelUpdateType.NONE; + } + type ClassicKeys = keyof typeof orgConfig; + const propsClassic = ['useDiffEditor', 'domReadOnly', 'readOnly', 'awaitExtensionReadiness', 'overrideAutomaticLayout', 'editorOptions', 'diffEditorOptions', 'languageDef', 'languageExtensionConfig', 'theme', 'themeData']; + const propCompareClassic = (name: string) => { + return orgConfig[name as ClassicKeys] !== config[name as ClassicKeys]; + }; + different = different || propsClassic.some(propCompareClassic); + return different; + } } diff --git a/packages/monaco-editor-wrapper/src/editorAppVscodeApi.ts b/packages/monaco-editor-wrapper/src/editorAppExtended.ts similarity index 52% rename from packages/monaco-editor-wrapper/src/editorAppVscodeApi.ts rename to packages/monaco-editor-wrapper/src/editorAppExtended.ts index 58ebdb7..614b973 100644 --- a/packages/monaco-editor-wrapper/src/editorAppVscodeApi.ts +++ b/packages/monaco-editor-wrapper/src/editorAppExtended.ts @@ -1,9 +1,12 @@ import type * as vscode from 'vscode'; -import { EditorAppBase, EditorAppBaseConfig, EditorAppType } from './editorAppBase.js'; +import { IDisposable, editor } from 'monaco-editor'; +import getThemeServiceOverride from '@codingame/monaco-vscode-theme-service-override'; +import getTextmateServiceOverride from '@codingame/monaco-vscode-textmate-service-override'; +import { whenReady as whenReadyTheme } from '@codingame/monaco-vscode-theme-defaults-default-extension'; +import { EditorAppBase, EditorAppConfigBase, ModelUpdateType, isModelUpdateRequired } from './editorAppBase.js'; import { registerExtension, IExtensionManifest, ExtensionHostKind } from 'vscode/extensions'; import { UserConfig } from './wrapper.js'; import { verifyUrlorCreateDataUrl } from './utils.js'; -import { IDisposable } from 'monaco-editor'; import { Logger } from './logger.js'; export type ExtensionConfig = { @@ -11,9 +14,14 @@ export type ExtensionConfig = { filesOrContents?: Map; }; -export type EditorAppConfigVscodeApi = EditorAppBaseConfig & { - $type: 'vscodeApi'; +export type UserConfiguration = { + json?: string; +} + +export type EditorAppConfigExtended = EditorAppConfigBase & { + $type: 'extended'; extensions?: ExtensionConfig[]; + userConfiguration?: UserConfiguration; }; export type RegisterExtensionResult = { @@ -34,25 +42,22 @@ export type RegisterLocalProcessExtensionResult = RegisterLocalExtensionResult & /** * The vscode-apo monaco-editor app uses vscode user and extension configuration for monaco-editor. */ -export class EditorAppVscodeApi extends EditorAppBase { +export class EditorAppExtended extends EditorAppBase { - private config: EditorAppConfigVscodeApi; + private config: EditorAppConfigExtended; private extensionRegisterResults: Map = new Map(); private logger: Logger | undefined; constructor(id: string, userConfig: UserConfig, logger?: Logger) { super(id); this.logger = logger; - this.config = this.buildConfig(userConfig) as EditorAppConfigVscodeApi; - const userInput = userConfig.wrapperConfig.editorAppConfig as EditorAppConfigVscodeApi; - this.config.extensions = userInput.extensions ?? undefined; - } - - getAppType(): EditorAppType { - return 'vscodeApi'; + const userAppConfig = userConfig.wrapperConfig.editorAppConfig as EditorAppConfigExtended; + this.config = this.buildConfig(userAppConfig) as EditorAppConfigExtended; + this.config.extensions = userAppConfig.extensions ?? undefined; + this.config.userConfiguration = userAppConfig.userConfiguration ?? undefined; } - getConfig(): EditorAppConfigVscodeApi { + getConfig(): EditorAppConfigExtended { return this.config; } @@ -60,17 +65,18 @@ export class EditorAppVscodeApi extends EditorAppBase { return this.extensionRegisterResults.get(extensionName); } - async createEditors(container: HTMLElement): Promise { - if (this.config.useDiffEditor) { - await this.createDiffEditor(container); - } else { - await this.createEditor(container); - } + override specifyServices(): editor.IEditorOverrideServices { + return { + ...getThemeServiceOverride(), + ...getTextmateServiceOverride() + }; } - async init() { - // await all extenson that should be ready beforehand - await this.awaitReadiness(this.config.awaitExtensionReadiness); + override async init() { + // await all extensions that should be ready beforehand + // always await theme extension + const awaitReadiness = (this.config.awaitExtensionReadiness ?? []).concat(whenReadyTheme); + await this.awaitReadiness(awaitReadiness); if (this.config.extensions) { const allPromises: Array> = []; @@ -89,8 +95,8 @@ export class EditorAppVscodeApi extends EditorAppBase { } // buildConfig ensures userConfiguration is available - await this.updateUserConfiguration(this.config.userConfiguration); - this.logger?.info('Init of VscodeApiConfig was completed.'); + await this.updateUserConfiguration(this.config.userConfiguration?.json); + this.logger?.info('Init of Extended App was completed.'); } disposeApp(): void { @@ -98,4 +104,18 @@ export class EditorAppVscodeApi extends EditorAppBase { this.disposeDiffEditor(); this.extensionRegisterResults.forEach((k) => k?.dispose()); } + + isAppConfigDifferent(orgConfig: EditorAppConfigExtended, config: EditorAppConfigExtended, includeModelData: boolean): boolean { + let different = false; + if (includeModelData) { + different = isModelUpdateRequired(orgConfig, config) !== ModelUpdateType.NONE; + } + const propsExtended = ['useDiffEditor', 'domReadOnly', 'readOnly', 'awaitExtensionReadiness', 'overrideAutomaticLayout', 'editorOptions', 'diffEditorOptions', 'userConfiguration', 'extensions']; + type ExtendedKeys = keyof typeof orgConfig; + const propCompareExtended = (name: string) => { + return orgConfig[name as ExtendedKeys] !== config[name as ExtendedKeys]; + }; + different = different || propsExtended.some(propCompareExtended); + return different; + } } diff --git a/packages/monaco-editor-wrapper/src/index.ts b/packages/monaco-editor-wrapper/src/index.ts index 73f07fd..6efc341 100644 --- a/packages/monaco-editor-wrapper/src/index.ts +++ b/packages/monaco-editor-wrapper/src/index.ts @@ -1,17 +1,14 @@ import { EditorAppBase, - isVscodeApiEditorApp, isCodeUpdateRequired, isModelUpdateRequired, - isAppConfigDifferent, ModelUpdateType } from './editorAppBase.js'; import type { - EditorAppBaseConfig, + EditorAppConfigBase, EditorAppType, - ModelUpdate, - UserConfiguration, + ModelUpdate } from './editorAppBase.js'; import type { @@ -19,19 +16,20 @@ import type { } from './editorAppClassic.js'; import { - EditorAppClassic, + EditorAppClassic } from './editorAppClassic.js'; import type { ExtensionConfig, - EditorAppConfigVscodeApi, + EditorAppConfigExtended, RegisterExtensionResult, RegisterLocalProcessExtensionResult, -} from './editorAppVscodeApi.js'; + UserConfiguration +} from './editorAppExtended.js'; import { - EditorAppVscodeApi -} from './editorAppVscodeApi.js'; + EditorAppExtended +} from './editorAppExtended.js'; import type { WebSocketCallOptions, @@ -67,11 +65,11 @@ import { export type { WrapperConfig, - EditorAppBaseConfig, + EditorAppConfigBase, EditorAppType, EditorAppConfigClassic, ExtensionConfig, - EditorAppConfigVscodeApi, + EditorAppConfigExtended, RegisterExtensionResult, RegisterLocalProcessExtensionResult, UserConfiguration, @@ -92,13 +90,11 @@ export { MonacoEditorLanguageClientWrapper, LanguageClientWrapper, EditorAppBase, - isVscodeApiEditorApp, isCodeUpdateRequired, isModelUpdateRequired, - isAppConfigDifferent, ModelUpdateType, EditorAppClassic, - EditorAppVscodeApi, + EditorAppExtended, Logger }; diff --git a/packages/monaco-editor-wrapper/src/languageClientWrapper.ts b/packages/monaco-editor-wrapper/src/languageClientWrapper.ts index 2f9d96c..d9d1246 100644 --- a/packages/monaco-editor-wrapper/src/languageClientWrapper.ts +++ b/packages/monaco-editor-wrapper/src/languageClientWrapper.ts @@ -72,11 +72,12 @@ export class LanguageClientWrapper { private languageClient: MonacoLanguageClient | undefined; private languageClientConfig?: LanguageClientConfig; private worker: Worker | undefined; - private languageId: string | undefined; + private languageId: string; private name; private logger: Logger | undefined; - constructor(languageClientConfig?: LanguageClientConfig, logger?: Logger) { + constructor(languageId: string, languageClientConfig?: LanguageClientConfig, logger?: Logger) { + this.languageId = languageId; if (languageClientConfig) { this.languageClientConfig = languageClientConfig; this.name = this.languageClientConfig.options.name ?? 'unnamed'; @@ -104,10 +105,6 @@ export class LanguageClientWrapper { return this.languageClient !== undefined && this.languageClient?.isRunning(); } - init(languageId: string) { - this.languageId = languageId; - } - async start() { if (this.languageClientConfig) { return this.startLanguageClientConnection(); diff --git a/packages/monaco-editor-wrapper/src/wrapper.ts b/packages/monaco-editor-wrapper/src/wrapper.ts index 079cb35..f24dd13 100644 --- a/packages/monaco-editor-wrapper/src/wrapper.ts +++ b/packages/monaco-editor-wrapper/src/wrapper.ts @@ -1,16 +1,15 @@ -import { editor } from 'monaco-editor'; -import { Uri } from 'vscode'; +import { editor, Uri } from 'monaco-editor'; import getConfigurationServiceOverride from '@codingame/monaco-vscode-configuration-service-override'; import { initServices, wasVscodeApiInitialized, InitializeServiceConfig, MonacoLanguageClient, mergeServices } from 'monaco-languageclient'; -import { EditorAppVscodeApi, EditorAppConfigVscodeApi } from './editorAppVscodeApi.js'; +import { EditorAppExtended, EditorAppConfigExtended } from './editorAppExtended.js'; import { EditorAppClassic, EditorAppConfigClassic } from './editorAppClassic.js'; -import { ModelUpdate, UserConfiguration, isVscodeApiEditorApp } from './editorAppBase.js'; +import { ModelUpdate } from './editorAppBase.js'; import { LanguageClientConfig, LanguageClientWrapper } from './languageClientWrapper.js'; import { Logger, LoggerConfig } from './logger.js'; export type WrapperConfig = { serviceConfig?: InitializeServiceConfig; - editorAppConfig: EditorAppConfigVscodeApi | EditorAppConfigClassic; + editorAppConfig: EditorAppConfigExtended | EditorAppConfigClassic; }; export type UserConfig = { @@ -29,12 +28,12 @@ export class MonacoEditorLanguageClientWrapper { private id: string; - private editorApp: EditorAppClassic | EditorAppVscodeApi | undefined; + private editorApp: EditorAppClassic | EditorAppExtended | undefined; private languageClientWrapper: LanguageClientWrapper; private serviceConfig: InitializeServiceConfig; private logger: Logger; - private async init(userConfig: UserConfig) { + private init(userConfig: UserConfig) { if (userConfig.wrapperConfig.editorAppConfig.useDiffEditor && !userConfig.wrapperConfig.editorAppConfig.codeOriginal) { throw new Error('Use diff editor was used without a valid config.'); } @@ -42,7 +41,9 @@ export class MonacoEditorLanguageClientWrapper { this.id = userConfig.id ?? Math.floor(Math.random() * 101).toString(); this.logger = new Logger(userConfig.loggerConfig); this.serviceConfig = userConfig.wrapperConfig.serviceConfig ?? {}; + } + private async initServices() { // always set required services if not configure this.serviceConfig.userServices = this.serviceConfig.userServices ?? {}; const configureService = this.serviceConfig.userServices.configure; @@ -53,6 +54,7 @@ export class MonacoEditorLanguageClientWrapper { }; mergeServices(mlcDefautServices, this.serviceConfig.userServices); } + mergeServices(this.editorApp?.specifyServices() ?? {}, this.serviceConfig.userServices); // overrule debug log flag this.serviceConfig.debugLogging = this.logger.isEnabled() && (this.serviceConfig.debugLogging || this.logger.isDebugEnabled()); @@ -63,26 +65,28 @@ export class MonacoEditorLanguageClientWrapper { this.logger.debug('Init Services', this.serviceConfig.debugLogging); await initServices(this.serviceConfig); } - this.languageClientWrapper = new LanguageClientWrapper(userConfig.languageClientConfig, this.logger); } async start(userConfig: UserConfig, htmlElement: HTMLElement | null) { if (!htmlElement) { throw new Error('No HTMLElement provided for monaco-editor.'); } - await this.init(userConfig); - // Always dispose old instances before start this.editorApp?.disposeApp(); - if (isVscodeApiEditorApp(userConfig.wrapperConfig)) { - this.editorApp = new EditorAppVscodeApi(this.id, userConfig, this.logger); - } else { + this.init(userConfig); + + if (userConfig.wrapperConfig.editorAppConfig.$type === 'classic') { this.editorApp = new EditorAppClassic(this.id, userConfig, this.logger); + } else { + this.editorApp = new EditorAppExtended(this.id, userConfig, this.logger); } - this.languageClientWrapper.init(this.editorApp.getConfig().languageId); - this.logger.info(`Starting monaco-editor (${this.id})`); + await this.initServices(); + + this.languageClientWrapper = new LanguageClientWrapper(this.editorApp.getConfig().languageId, + userConfig.languageClientConfig, this.logger); + this.logger.info(`Starting monaco-editor (${this.id})`); await this.editorApp?.init(); await this.editorApp.createEditors(htmlElement); @@ -135,10 +139,6 @@ export class MonacoEditorLanguageClientWrapper { await this.editorApp?.updateDiffModel(modelUpdate); } - updateUserConfiguration(config: UserConfiguration) { - return this.editorApp?.updateUserConfiguration(config); - } - public reportStatus() { const status: string[] = []; status.push('Wrapper status:'); diff --git a/packages/monaco-editor-wrapper/test/editorAppBase.test.ts b/packages/monaco-editor-wrapper/test/editorAppBase.test.ts index c9d223e..5faa07a 100644 --- a/packages/monaco-editor-wrapper/test/editorAppBase.test.ts +++ b/packages/monaco-editor-wrapper/test/editorAppBase.test.ts @@ -1,17 +1,17 @@ import { describe, expect, test } from 'vitest'; -import { isAppConfigDifferent, isVscodeApiEditorApp, isModelUpdateRequired, EditorAppClassic, ModelUpdateType, EditorAppConfigVscodeApi } from 'monaco-editor-wrapper'; +import { isModelUpdateRequired, EditorAppClassic, ModelUpdateType, EditorAppConfigExtended, EditorAppExtended, EditorAppConfigClassic } from 'monaco-editor-wrapper'; import { createBaseConfig, createEditorAppConfig, createWrapperConfig } from './helper.js'; describe('Test EditorAppBase', () => { - test('isVscodeApiEditorApp: empty EditorAppConfigClassic', () => { + test('classic type: empty EditorAppConfigClassic', () => { const wrapperConfig = createWrapperConfig('classic'); - expect(isVscodeApiEditorApp(wrapperConfig)).toBeFalsy(); + expect(wrapperConfig.editorAppConfig.$type).toBe('classic'); }); - test('isVscodeApiEditorApp: empty EditorAppConfigVscodeApi', () => { - const wrapperConfig = createWrapperConfig('vscodeApi'); - expect(isVscodeApiEditorApp(wrapperConfig)).toBeTruthy(); + test('extended type: empty EditorAppConfigExtended', () => { + const wrapperConfig = createWrapperConfig('extended'); + expect(wrapperConfig.editorAppConfig.$type).toBe('extended'); }); test('config defaults', () => { @@ -25,54 +25,56 @@ describe('Test EditorAppBase', () => { expect(app.getConfig().codeOriginalUri).toBeUndefined(); expect(app.getConfig().readOnly).toBeFalsy(); expect(app.getConfig().domReadOnly).toBeFalsy(); - expect(app.getConfig().userConfiguration?.json).toBeUndefined(); }); test('config userConfiguration', () => { - const config = createBaseConfig('classic'); - config.wrapperConfig.editorAppConfig.userConfiguration = { + const config = createBaseConfig('extended'); + const appConfig = config.wrapperConfig.editorAppConfig as EditorAppConfigExtended; + appConfig.userConfiguration = { json: '{ "editor.semanticHighlighting.enabled": true }' }; - const app = new EditorAppClassic('config defaults', config); + const app = new EditorAppExtended('config defaults', config); expect(app.getConfig().userConfiguration?.json).toEqual('{ "editor.semanticHighlighting.enabled": true }'); }); test('isModelUpdateRequired', () => { const config = createEditorAppConfig('classic'); let modelUpdateType = isModelUpdateRequired(config, { languageId: 'typescript', code: '' }); - expect(modelUpdateType).toBe(ModelUpdateType.none); + expect(modelUpdateType).toBe(ModelUpdateType.NONE); modelUpdateType = isModelUpdateRequired(config, { languageId: 'typescript' }); - expect(modelUpdateType).toBe(ModelUpdateType.none); + expect(modelUpdateType).toBe(ModelUpdateType.NONE); modelUpdateType = isModelUpdateRequired(config, { languageId: 'typescript', code: 'test' }); - expect(modelUpdateType).toBe(ModelUpdateType.code); + expect(modelUpdateType).toBe(ModelUpdateType.CODE); modelUpdateType = isModelUpdateRequired(config, { languageId: 'javascript', code: 'test' }); - expect(modelUpdateType).toBe(ModelUpdateType.model); + expect(modelUpdateType).toBe(ModelUpdateType.MODEL); }); test('isAppConfigDifferent: classic', () => { - const orgConfig = createEditorAppConfig('classic'); - const config = createEditorAppConfig('classic'); - expect(isAppConfigDifferent(orgConfig, config, false, false)).toBeFalsy(); + const orgConfig = createEditorAppConfig('classic') as EditorAppConfigClassic; + const config = createEditorAppConfig('classic') as EditorAppConfigClassic; + const app = new EditorAppClassic('test', createBaseConfig('classic')); + expect(app.isAppConfigDifferent(orgConfig, config, false)).toBeFalsy(); config.code = 'test'; - expect(isAppConfigDifferent(orgConfig, config, false, false)).toBeFalsy(); - expect(isAppConfigDifferent(orgConfig, config, true, false)).toBeTruthy(); + expect(app.isAppConfigDifferent(orgConfig, config, false)).toBeFalsy(); + expect(app.isAppConfigDifferent(orgConfig, config, true)).toBeTruthy(); config.code = ''; config.useDiffEditor = true; - expect(isAppConfigDifferent(orgConfig, config, false, false)).toBeTruthy(); + expect(app.isAppConfigDifferent(orgConfig, config, false)).toBeTruthy(); }); - test('isAppConfigDifferent: vscodeApi', () => { - const orgConfig = createEditorAppConfig('vscodeApi') as EditorAppConfigVscodeApi; - const config = createEditorAppConfig('vscodeApi') as EditorAppConfigVscodeApi; - expect(isAppConfigDifferent(orgConfig, config, false, true)).toBeFalsy(); + test('isAppConfigDifferent: vscode', () => { + const orgConfig = createEditorAppConfig('extended') as EditorAppConfigExtended; + const config = createEditorAppConfig('extended') as EditorAppConfigExtended; + const app = new EditorAppExtended('test', createBaseConfig('extended')); + expect(app.isAppConfigDifferent(orgConfig, config, false)).toBeFalsy(); config.code = 'test'; - expect(isAppConfigDifferent(orgConfig, config, true, false)).toBeTruthy(); + expect(app.isAppConfigDifferent(orgConfig, config, true)).toBeTruthy(); config.code = ''; config.extensions = [{ @@ -85,7 +87,7 @@ describe('Test EditorAppBase', () => { } } }]; - expect(isAppConfigDifferent(orgConfig, config, false, false)).toBeTruthy(); + expect(app.isAppConfigDifferent(orgConfig, config, false)).toBeTruthy(); }); }); diff --git a/packages/monaco-editor-wrapper/test/editorAppClassic.test.ts b/packages/monaco-editor-wrapper/test/editorAppClassic.test.ts index 7dac7fc..b9539ea 100644 --- a/packages/monaco-editor-wrapper/test/editorAppClassic.test.ts +++ b/packages/monaco-editor-wrapper/test/editorAppClassic.test.ts @@ -17,7 +17,7 @@ describe('Test EditorAppClassic', () => { const app = new EditorAppClassic('config defaults', config); expect(configclassic.$type).toEqual('classic'); - expect(app.getConfig().userConfiguration?.json).toEqual('{"editor.semanticHighlighting.enabled":true}'); + expect(app.getConfig().editorOptions?.['semanticHighlighting.enabled']).toEqual(true); }); test('editorOptions: semanticHighlighting=false', () => { @@ -26,7 +26,7 @@ describe('Test EditorAppClassic', () => { configclassic.editorOptions!['semanticHighlighting.enabled'] = false; const app = new EditorAppClassic('config defaults', config); - expect(app.getConfig().userConfiguration?.json).toEqual('{"editor.semanticHighlighting.enabled":false}'); + expect(app.getConfig().editorOptions?.['semanticHighlighting.enabled']).toEqual(false); }); test('editorOptions: semanticHighlighting="configuredByTheme"', () => { @@ -35,6 +35,6 @@ describe('Test EditorAppClassic', () => { configclassic.editorOptions!['semanticHighlighting.enabled'] = 'configuredByTheme'; const app = new EditorAppClassic('config defaults', config); - expect(app.getConfig().userConfiguration?.json).toEqual('{"editor.semanticHighlighting.enabled":"configuredByTheme"}'); + expect(app.getConfig().editorOptions?.['semanticHighlighting.enabled']).toEqual('configuredByTheme'); }); }); diff --git a/packages/monaco-editor-wrapper/test/editorAppVscodeApi.test.ts b/packages/monaco-editor-wrapper/test/editorAppExtended.test.ts similarity index 83% rename from packages/monaco-editor-wrapper/test/editorAppVscodeApi.test.ts rename to packages/monaco-editor-wrapper/test/editorAppExtended.test.ts index 6abb5e2..eb2bb31 100644 --- a/packages/monaco-editor-wrapper/test/editorAppVscodeApi.test.ts +++ b/packages/monaco-editor-wrapper/test/editorAppExtended.test.ts @@ -1,10 +1,10 @@ import { describe, expect, test } from 'vitest'; import { verifyUrlorCreateDataUrl } from 'monaco-editor-wrapper'; -describe('Test EditorAppVscodeApi', () => { +describe('Test EditorAppExtended', () => { test('verifyUrlorCreateDataUrl: url', () => { - const url = new URL('./editorVscodeApi.test.ts', import.meta.url); + const url = new URL('./editorAppExtended.test.ts', import.meta.url); expect(verifyUrlorCreateDataUrl(url)).toBe(url.href); }); diff --git a/packages/monaco-editor-wrapper/test/languageClientWrapper.test.ts b/packages/monaco-editor-wrapper/test/languageClientWrapper.test.ts index 09dfb51..2cc62ce 100644 --- a/packages/monaco-editor-wrapper/test/languageClientWrapper.test.ts +++ b/packages/monaco-editor-wrapper/test/languageClientWrapper.test.ts @@ -4,14 +4,14 @@ import { LanguageClientConfig, LanguageClientWrapper } from 'monaco-editor-wrapp describe('Test LanguageClientWrapper', () => { test('Not Running after construction', () => { - const languageClientWrapper = new LanguageClientWrapper(); + const languageClientWrapper = new LanguageClientWrapper('my-lang'); expect(languageClientWrapper.haveLanguageClient()).toBeFalsy(); expect(languageClientWrapper.haveLanguageClientConfig()).toBeFalsy(); expect(languageClientWrapper.isStarted()).toBeFalsy(); }); test('Constructor: no config', async () => { - const languageClientWrapper = new LanguageClientWrapper(); + const languageClientWrapper = new LanguageClientWrapper('my-lang'); expect(async () => { await languageClientWrapper.start(); }).rejects.toEqual({ @@ -37,7 +37,7 @@ describe('Test LanguageClientWrapper', () => { }); // setup the wrapper - const languageClientWrapper = new LanguageClientWrapper({ + const languageClientWrapper = new LanguageClientWrapper('my-lang', { options: { $type: 'WorkerDirect', worker @@ -61,7 +61,7 @@ describe('Test LanguageClientWrapper', () => { url: 'ws://localhost:12345/Tester' } }; - const languageClientWrapper = new LanguageClientWrapper(languageClientConfig); + const languageClientWrapper = new LanguageClientWrapper('my-lang', languageClientConfig); expect(languageClientWrapper.haveLanguageClientConfig()).toBeTruthy(); }); @@ -73,7 +73,7 @@ describe('Test LanguageClientWrapper', () => { name: 'test-unreachable' } }; - const languageClientWrapper = new LanguageClientWrapper(languageClientConfig); + const languageClientWrapper = new LanguageClientWrapper('my-lang', languageClientConfig); expect(languageClientWrapper.haveLanguageClientConfig()).toBeTruthy(); await expect(languageClientWrapper.start()).rejects.toEqual({ message: 'languageClientWrapper (test-unreachable): Websocket connection failed.', @@ -100,7 +100,7 @@ describe('Test LanguageClientWrapper', () => { type: 'classic' } }; - const languageClientWrapper = new LanguageClientWrapper(languageClientConfig); + const languageClientWrapper = new LanguageClientWrapper('my-lang', languageClientConfig); expect(languageClientWrapper.haveLanguageClientConfig()).toBeTruthy(); await expect(languageClientWrapper.start()).rejects.toEqual({ message: 'languageClientWrapper (unnamed): Illegal worker configuration detected. Potentially the url is wrong.', diff --git a/packages/monaco-editor-wrapper/test/utils.test.ts b/packages/monaco-editor-wrapper/test/utils.test.ts index 300be09..11c6ac6 100644 --- a/packages/monaco-editor-wrapper/test/utils.test.ts +++ b/packages/monaco-editor-wrapper/test/utils.test.ts @@ -7,22 +7,22 @@ describe('createUrl', () => { const url = createUrl({ secured: false, host: 'localhost', - port: 3000, + port: 30000, path: 'sampleServer' } as WebSocketConfigOptions); - expect(url).toBe('ws://localhost:3000/sampleServer'); + expect(url).toBe('ws://localhost:30000/sampleServer'); }); test('test createUrl: wss', () => { const url = createUrl({ secured: true, host: 'localhost', - port: 3000, + port: 30000, path: 'sampleServer' } as WebSocketConfigOptions); - expect(url).toBe('wss://localhost:3000/sampleServer'); + expect(url).toBe('wss://localhost:30000/sampleServer'); }); test('test createUrl: wss, no port, with path', () => { @@ -39,10 +39,10 @@ describe('createUrl', () => { const url = createUrl({ secured: true, host: 'localhost', - port: 3000 + port: 30000 } as WebSocketConfigOptions); - expect(url).toBe('wss://localhost:3000'); + expect(url).toBe('wss://localhost:30000'); }); test('test createUrl: wss, no port, no path', () => { @@ -77,26 +77,26 @@ describe('createUrl', () => { test('test createUrl: optionsUrl: ws', () => { const url = createUrl({ - url: 'ws://localhost:3000/sampleServer' + url: 'ws://localhost:30000/sampleServer' } as WebSocketConfigOptionsUrl); - expect(url).toBe('ws://localhost:3000/sampleServer'); + expect(url).toBe('ws://localhost:30000/sampleServer'); }); test('test createUrl: optionsUrl: wss', () => { const url = createUrl({ - url: 'wss://localhost:3000/sampleServer' + url: 'wss://localhost:30000/sampleServer' } as WebSocketConfigOptionsUrl); - expect(url).toBe('wss://localhost:3000/sampleServer'); + expect(url).toBe('wss://localhost:30000/sampleServer'); }); test('test createUrl: optionsUrl, with port, no path', () => { const url = createUrl({ - url: 'wss://localhost:3000' + url: 'wss://localhost:30000' } as WebSocketConfigOptionsUrl); - expect(url).toBe('wss://localhost:3000'); + expect(url).toBe('wss://localhost:30000'); }); test('test createUrl: optionsUrl, no port, with path', () => { @@ -117,8 +117,8 @@ describe('createUrl', () => { test('test createUrl: ws, not proper url', () => { expect(() => createUrl({ - url: 'http://www.testme.com:3000/sampleServer' - } as WebSocketConfigOptionsUrl)).toThrowError('This is not a proper websocket url: http://www.testme.com:3000/sampleServer'); + url: 'http://www.testme.com:30000/sampleServer' + } as WebSocketConfigOptionsUrl)).toThrowError('This is not a proper websocket url: http://www.testme.com:30000/sampleServer'); }); }); diff --git a/packages/monaco-editor-wrapper/test/wrapper.test.ts b/packages/monaco-editor-wrapper/test/wrapper.test.ts index 4703a81..ba9614b 100644 --- a/packages/monaco-editor-wrapper/test/wrapper.test.ts +++ b/packages/monaco-editor-wrapper/test/wrapper.test.ts @@ -24,10 +24,9 @@ describe('Test MonacoEditorLanguageClientWrapper', () => { const app = wrapper.getMonacoEditorApp() as EditorAppClassic; expect(app).toBeDefined(); - expect(app.getAppType()).toBe('classic'); const appConfig = app.getConfig(); - expect(appConfig.automaticLayout).toBeTruthy(); + expect(appConfig.overrideAutomaticLayout).toBeTruthy(); expect(appConfig.theme).toBe('vs-light'); });