From 9d4c543f00e2e7cecebbbac47bfa6b46bd96d525 Mon Sep 17 00:00:00 2001 From: Kai Salmen Date: Mon, 18 Mar 2024 14:28:10 +0100 Subject: [PATCH] Documentation update, make LICENSE usage consistent --- README.md | 203 ++++++------------ docs/versions-and-history.md | 2 +- packages/client/{License.txt => LICENSE} | 6 +- packages/client/README.md | 41 +++- packages/client/package.json | 2 +- packages/client/src/index.ts | 2 +- packages/client/src/vscode/services.ts | 2 +- packages/examples/{License.txt => LICENSE} | 6 +- packages/examples/README.md | 10 +- packages/examples/package.json | 2 +- packages/examples/src/browser/main.ts | 2 +- .../src/common/example-apps-common.ts | 2 +- .../src/common/language-server-runner.ts | 2 +- .../examples/src/common/server-commons.ts | 2 +- packages/examples/src/groovy/client/main.ts | 2 +- packages/examples/src/groovy/config.ts | 2 +- packages/examples/src/groovy/server/README.md | 19 ++ packages/examples/src/groovy/server/direct.ts | 2 +- packages/examples/src/groovy/server/main.ts | 2 +- packages/examples/src/index.ts | 2 +- .../examples/src/json/client/wrapperWs.ts | 2 +- packages/examples/src/json/server/direct.ts | 2 +- .../examples/src/json/server/json-server.ts | 2 +- packages/examples/src/json/server/main.ts | 2 +- .../langium-dsl/config/classicConfig.ts | 2 +- .../langium-dsl/config/extendedConfig.ts | 2 +- .../langium-dsl/config/langium.monarch.ts | 2 +- .../langium-dsl/worker/langium-server.ts | 2 +- .../src/langium/langium-dsl/wrapperLangium.ts | 2 +- .../config/wrapperStatemachineConfig.ts | 2 +- .../src/langium/statemachine/main-react.tsx | 2 +- .../examples/src/langium/statemachine/main.ts | 2 +- .../worker/statemachine-server-port.ts | 2 +- .../worker/statemachine-server-start.ts | 2 +- .../worker/statemachine-server.ts | 2 +- packages/examples/src/node.ts | 2 +- packages/examples/src/python/client/config.ts | 2 +- packages/examples/src/python/client/main.ts | 2 +- .../src/python/client/reactPython.tsx | 2 +- packages/examples/src/python/server/direct.ts | 2 +- packages/examples/src/python/server/main.ts | 2 +- packages/examples/src/ts/wrapperAdvanced.ts | 2 +- packages/examples/src/ts/wrapperTs.ts | 2 +- packages/examples/src/utils/fs-utils.ts | 2 +- packages/examples/src/utils/localeLoader.ts | 2 +- .../{License.txt => LICENSE} | 6 +- packages/vscode-ws-jsonrpc/README.md | 23 +- packages/vscode-ws-jsonrpc/package.json | 2 +- packages/vscode-ws-jsonrpc/src/connection.ts | 2 +- packages/vscode-ws-jsonrpc/src/disposable.ts | 2 +- packages/vscode-ws-jsonrpc/src/index.ts | 2 +- packages/vscode-ws-jsonrpc/src/logger.ts | 2 +- .../src/server/connection.ts | 2 +- .../vscode-ws-jsonrpc/src/server/index.ts | 2 +- .../vscode-ws-jsonrpc/src/server/launch.ts | 2 +- .../src/socket/connection.ts | 2 +- .../vscode-ws-jsonrpc/src/socket/index.ts | 2 +- .../vscode-ws-jsonrpc/src/socket/reader.ts | 2 +- .../vscode-ws-jsonrpc/src/socket/socket.ts | 2 +- .../vscode-ws-jsonrpc/src/socket/writer.ts | 2 +- packages/wrapper-react/LICENSE | 2 +- packages/wrapper-react/README.md | 49 ++--- packages/wrapper-react/package.json | 5 +- packages/wrapper-react/src/index.tsx | 2 +- packages/wrapper-react/vite.bundle.config.ts | 2 +- packages/wrapper/LICENSE | 2 +- packages/wrapper/README.md | 44 ++-- packages/wrapper/build/buildAllWorkers.mts | 2 +- packages/wrapper/build/buildWorker.mts | 2 +- packages/wrapper/build/vite.cssWorker.ts | 2 +- packages/wrapper/build/vite.editorWorker.ts | 2 +- packages/wrapper/build/vite.htmlWorker.ts | 2 +- packages/wrapper/build/vite.jsonWorker.ts | 2 +- packages/wrapper/build/vite.tsWorker.ts | 2 +- packages/wrapper/package.json | 9 +- packages/wrapper/src/commonTypes.ts | 2 +- packages/wrapper/src/editorAppBase.ts | 2 +- packages/wrapper/src/editorAppClassic.ts | 2 +- packages/wrapper/src/editorAppExtended.ts | 2 +- packages/wrapper/src/index.ts | 2 +- packages/wrapper/src/languageClientWrapper.ts | 2 +- packages/wrapper/src/logger.ts | 2 +- packages/wrapper/src/utils.ts | 2 +- packages/wrapper/src/vscode/services.ts | 2 +- packages/wrapper/src/workerFactory.ts | 2 +- packages/wrapper/src/wrapper.ts | 9 +- packages/wrapper/test/editorAppBase.test.ts | 2 +- .../wrapper/test/editorAppClassic.test.ts | 2 +- .../wrapper/test/editorAppExtended.test.ts | 2 +- packages/wrapper/test/helper.ts | 2 +- .../test/languageClientWrapper.test.ts | 2 +- packages/wrapper/test/logger.test.ts | 2 +- packages/wrapper/test/utils.test.ts | 2 +- packages/wrapper/test/wrapper.test.ts | 2 +- packages/wrapper/vite.bundle.config.ts | 2 +- verify/angular/custom-webpack.config.js | 2 +- verify/angular/src/app/app.component.ts | 2 +- verify/angular/src/app/app.module.ts | 2 +- verify/angular/src/main.ts | 2 +- verify/buildAll.ps1 | 2 +- verify/buildAll.sh | 2 +- verify/pnpm/src/client/main.ts | 2 +- verify/vite/src/client/main.ts | 2 +- verify/webpack/src/client/main.ts | 2 +- verify/webpack/webpack.config.js | 2 +- verify/yarn/src/client/main.ts | 2 +- vite.config.ts | 2 +- 107 files changed, 294 insertions(+), 324 deletions(-) rename packages/client/{License.txt => LICENSE} (92%) rename packages/examples/{License.txt => LICENSE} (92%) create mode 100644 packages/examples/src/groovy/server/README.md rename packages/vscode-ws-jsonrpc/{License.txt => LICENSE} (92%) diff --git a/README.md b/README.md index 963ebcedd..731293414 100644 --- a/README.md +++ b/README.md @@ -17,40 +17,46 @@ This repository now multiple npm packages under under roof: Click [here](https://www.typefox.io/blog/teaching-the-language-server-protocol-to-microsofts-monaco-editor/) for a detail explanation how to connect the Monaco editor to your language server. - [Monaco Language Client \& VSCode WebSocket Json RPC](#monaco-language-client--vscode-websocket-json-rpc) + - [Changelogs, project history and compatibility](#changelogs-project-history-and-compatibility) - [Getting started](#getting-started) - [Vite dev server](#vite-dev-server) - - [Using monaco-languageclient](#using-monaco-languageclient) - - [NEW with v8: Own monaco-editor-api package](#new-with-v8-own-monaco-editor-api-package) - - [Using services and extra packages from @codingame/monaco-vscode-api](#using-services-and-extra-packages-from-codingamemonaco-vscode-api) - - [textmate and monarch](#textmate-and-monarch) + - [Usage](#usage) - [Examples Overview](#examples-overview) - [Main Examples](#main-examples) - - [Verification Examples](#verification-examples) - - [Pure bundler verification](#pure-bundler-verification) - [Example usage](#example-usage) - [Server processes](#server-processes) - [JSON Language Server](#json-language-server) - [Pyright Language Server](#pyright-language-server) - [Groovy Language Server](#groovy-language-server) - - [Verification Example Servers](#verification-example-servers) + - [Verification Examples \& Usage](#verification-examples--usage) - [VSCode integration](#vscode-integration) - [Featured projects](#featured-projects) - [Troubleshooting](#troubleshooting) - [General](#general) - - [Dependency issues: monaco-editor / @codingame/monaco-editor-treemended](#dependency-issues-monaco-editor--codingamemonaco-editor-treemended) + - [Dependency issues: monaco-editor / @codingame/monaco-vscode-api / @codingame/monaco-vscode-editor-api](#dependency-issues-monaco-editor--codingamemonaco-vscode-api--codingamemonaco-vscode-editor-api) - [Volta](#volta) - [Vite dev server troubleshooting](#vite-dev-server-troubleshooting) - [Serve all files required](#serve-all-files-required) - [Bad Polyfills](#bad-polyfills) - [buffer](#buffer) - - [monaco-editor-core](#monaco-editor-core) - - [@monaco-editor/react](#monaco-editorreact) + - [monaco-editor and react](#monaco-editor-and-react) - [pnpm](#pnpm) - - [Monaco-editor / @codingame/monaco-vscode-api compatibility table](#monaco-editor--codingamemonaco-vscode-api-compatibility-table) - - [Important Project Changes](#important-project-changes) - - [Changelogs](#changelogs) - [Licenses](#licenses) +## Changelogs, project history and compatibility + +CHANGELOGs for each project are available from the linked location: + +- CHANGELOG for `monaco-languageclient` is found [here](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/client/CHANGELOG.md) +- CHANGELOG for `vscode-ws-jsonrpc` is found [here](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/vscode-ws-jsonrpc/CHANGELOG.md) +- CHANGELOG for `monaco-editor-wrapper` is found [here](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/wrapper/CHANGELOG.md) +- CHANGELOG for `@typefox/monaco-editor-react` is found [here](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/wrapper-react/CHANGELOG.md) +- CHANGELOG for `monaco-languageclient-examples` is found [here](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/examples/CHANGELOG.md) + +Important Project changes and notes about the project's history are found [here](https://github.com/TypeFox/monaco-languageclient/blob/main/docs/versions-and-history.md#important-project-changes). + +You find the `monaco-editor`, `vscode`, `@codingame/monaco-vscode-api` and `@codingame/monaco-vscode-editor-api` compatibility table [here](https://github.com/TypeFox/monaco-languageclient/blob/main/docs/versions-and-history.md#monaco-editor--codingamemonaco-vscode-api-compatibility-table). + ## Getting started On your local machine you can prepare your dev environment as follows. At first it is advised to build everything. Or, use a fresh dev environment in [Gitpod](https://www.gitpod.io) by pressing the **code now** badge above. @@ -82,74 +88,46 @@ If you want to change the libries and see this reflected directly, then you need npm run watch ``` -## Using monaco-languageclient - -### NEW with v8: Own monaco-editor-api package - -Since version 2 (see [Important Project Changes](#important-project-changes)) of this library we rely on [@codingame/monaco-vscode-api](https://github.com/CodinGame/monaco-vscode-api) to supply the vscode API. It evolved substantially since then and thesedays allows to use many vscode only services with `monaco-editor`. With v6 and v7 we "treemend" used a "treemended" version of `monaco-editor` which brought back monaco-editor code that was removed during bundling/threeshaking (*treemending*). This left users with the need to define overrides / resolution which was problematic. -Therefore [monaco-vscode-editor-api](https://www.npmjs.com/package/@codingame/monaco-editor-wrapper) is now used and installed as an alias to monaco-editor because it provides the same api as the official monaco-editor. +## Usage -### Using services and extra packages from @codingame/monaco-vscode-api +Please look at the respective section in the packages: -The bespoke projects not only supplies the api, but it provides 100+ packages with additional services, default extensions and language packs. By default when initalizing `monaco-languageclient` via the required `initServices` the following services are always loaded: - -- *languages* and model *services* (always added by `monaco-languagclient`) -- *layout*, *environment*, *extension*, *files* and *quickAccess* (always added by `monaco-vscode-api`) - -Please check the [following link](https://github.com/CodinGame/monaco-vscode-api#monaco-standalone-services) for information about all services supplied by [@codingame/monaco-vscode-api](https://github.com/CodinGame/monaco-vscode-api). - -Please check our examples [in the examples overview chapter](#examples-overview) as they demonstrate the usage (jump-start: [python client](./packages/examples/src/python/client/main.ts) for services and default extension usage or [Langium Statemachine](./packages/examples/src/langium/statemachine/main.ts) / [Locale Loader](./packages/examples/src/utils/localeLoader.ts)) - -#### textmate and monarch - -If you use the `textmate` or `theme` services you are able to load textmate based grammars and theme definitions from vscode: - -```js -import getThemeServiceOverride from '@codingame/monaco-vscode-theme-service-override'; -import getTextmateServiceOverride from '@codingame/monaco-vscode-textmate-service-override'; -``` - -Once you those services you can no longer make use of monarch based grammars and themes. +- Usage for `monaco-languageclient` is found [here](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/client/README.md#usage) +- Usage for `vscode-ws-jsonrpc` is found [here](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/vscode-ws-jsonrpc/README.md#usage) +- Usage for `monaco-editor-wrapper` is found [here](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/wrapper/README.md#usage) +- Usage for `@typefox/monaco-editor-react` is found [here](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/wrapper-react/README.md#usage) ## Examples Overview -There are a couple of different examples that demonstrate how the `monaco-languageclient` can be used. +The examples demonstrate mutliple things: + +- How `monaco-languageclient` is use by `monaco-edtior-wrapper` or `@typefox/monaco-editor-react` to have an editor that is connected to a language server either running in the browser in a web worker or `vscode-ws-jsonrpc`. is used to an external process via web-socket. +- How different language servers can be intergrated in a common way, so they can communicate via web-socket to the front-end running in the browser. ### Main Examples - [JSON Language client and language server example](./packages/examples/src/json): - The **json-server** runs an external Node.js [Express app](./packages/examples/src/json/server/main.ts) where web sockets are used to enable communication between the language server process and the client web application (see [JSON Language Server](#json-language-server)). - - The **json-client** contains the [client web app](./packages/examples/src/json/client/main.ts) which connects to the language server therefore requires the node server app to be run in parallel. + - The **json-client** contains the [monaco-editor-wrapper app](./packages/examples/src/json/client/wrapperWs.ts) which connects to the language server and therefore requires the node server app to be run in parallel. - [Python Language client and pyright language server example](./packages/examples/src/python): - The **python-server** runs an external Node.js [Express app](./packages/examples/src/python/server/main.ts) where web sockets are used to enable communication between the language server process and the client web application (see [Pyright Language Server](#pyright-language-server)). - - The **python-client** contains the [client web app](./packages/examples/src/python/client/main.ts) which connects to the language server therefore requires the node server app to be run in parallel. + - The **python-client** contains the [monaco-editor-wrapper app](./packages/examples/src/python/client/main.ts) which connects to the language server and therefore requires the node server app to be run in parallel. - [Groovy Language client and language server example](./packages/examples/src/groovy): - The **groovy-server** runs an external [Java app](./packages/examples/src/groovy/server/main.ts) where web sockets are used to enable communication between the language server process and the client web application ([Groovy Language Server](#groovy-language-server)). - - The **groovy-client** contains the [client web app](./packages/examples/src/python/client/main.ts) which connects to the language server therefore requires the node server app to be run in parallel. - -- Langium example: - - Statemachine DSL (created with Langium) **statemachine-web-worker-language-server** example located in [./packages/examples/src/langium](./packages/examples/src/langium) contains both the [language client](./packages/examples/src/langium/statemachineClient.ts) and the [langauge server (web worker)](https://github.com/langium/langium/blob/main/examples/statemachine/src/language-server/main-browser.ts). The web worker example communicate via `vscode-languageserver-protocol/browser` instead of a web socket used in the **JSON examples** examples. - -- The **browser** example located in [./packages/examples/src/browser](./packages/examples/src/browser) demonstrates how a [language service written in JavaScript](./packages/examples/src/browser/main.ts) can be used in a Monaco Editor contained in a simple HTML page. This example can now be considered legacy as the web worker option eases client side language server implementation and separation. - -- The **react-client** example located in [./packages/examples/src/react](./packages/examples/src/react) contains the [React client](./packages/examples/src/react/main.tsx). It does the same as the regular client example but inside a React Functional Component. - -- The **angular-client** example is now found in [its own repository](https://github.com/TypeFox/monaco-languageclient-ng-example.git) - -**Important:** Apart from the **json-server** and **python-server** process all other will be server by the [Vite dev server](#vite-dev-server). Some examples share [common code](./packages/examples/src/common.ts) to reduce the amount of redundant code. + - The **groovy-client** contains the [monaco-editor-wrapper app](./packages/examples/src/python/client/main.ts) which connects to the language server and therefore requires the node server app to be run in parallel. + - It is also possible to use a [@typefox/monaco-editor-react app](./packages/examples/src/python/client/reactPython.tsx) to connect to the server. -### Verification Examples +- Langium examples (here client and server communicate via `vscode-languageserver-protocol/browser` instead of a web socket used in the three examples above: + - [Langium grammar DSL](./packages/examples/src/langium/langium-dsl): It contains both the [language client](./packages/examples/src/langium/langium-dsl/wrapperLangium.ts) and the [langauge server (web worker)](./packages/examples/src/langium/langium-dsl/worker/langium-server.ts). Here you can chose beforehand if the wrapper should be started in classic or extended mode. + - [Statemachine DSL (created with Langium)](./packages/examples/src/langium/statemachine): It contains both the [language client](./packages/examples/src/langium/statemachine/main.ts) and the [langauge server (web worker)](./packages/examples/src/langium/statemachine/worker/statemachine-server.ts). + - It is also possible to use a [@typefox/monaco-editor-react app](./packages/examples/src/langium/statemachine/main-react.tsx) to connect to the server. -- The **webpack** verification example located in [./packages/verify/webpack](./packages/verify/webpack) demonstrates how bundling can be achieved with webpack. You find the configuration here: [webpack.config.js](./packages/verify/webpack/webpack.config.js). +- [browser example](./packages/examples/src/browser) demonstrates how a [monaco-editor-wrapper can be combined with a language service written in JavaScript](./packages/examples/src/browser/main.ts). This example can now be considered legacy as the web worker option eases client side language server implementation and separation, but it still shows a valid way to achieve the desired outcome. -- The **vite** verification example located in [./packages/verify/vite](./packages/verify/vite) demonstrates how bundling can be achieved with vite. There is no configuration required. - -#### Pure bundler verification - -- [./packages/verify/pnpm](./packages/verify/pnpm) is not part of the npm workspace. It allows to test whether `pnpm install` works as expected and it allows to test `@codingame/monaco-vscode-api` treemending via `pnpm run test:treemending`. -- [./packages/verify/yarn](./packages/verify/yarn) is not part of the npm workspace. It allows to test whether `yarn install` works as expected and it allows to test `@codingame/monaco-vscode-api` treemending via `yarn run test:treemending`. +- [Typescript Language support](./packages/examples/src/ts/wrapperTs.ts) +- [Multi-editor usage](./packages/examples/src/ts/wrapperAdvanced.ts) ### Example usage @@ -175,38 +153,25 @@ npm run start:example:server:python ##### Groovy Language Server -For the **groovy-client** example you need to ensure the **groovy-server** example is running: - -**Preferred option** +For the **groovy-client** example you need to ensure the **groovy-server** example is running. There are two options available: -Use **docker-compose** which does not require any manual setup (Java/Gradle). From the project root run `docker-compose -f ./packages/examples/resources/groovy/docker-compose.yml up -d`. First start up will take longer as the container is built. Use `docker-compose -f ./packages/examples/resources/groovy/docker-compose.yml down` to stop it. +- **Preferred option**: Use **docker-compose** which does not require any manual setup (Java/Gradle). From the project root run `docker-compose -f ./packages/examples/resources/groovy/docker-compose.yml up -d`. First start up will take longer as the container is built. Use `docker-compose -f ./packages/examples/resources/groovy/docker-compose.yml down` to stop it. -**Secondary option** +- **Secondary option** (not recommended): [Groovy Language Server self-built instructions](./packages/examples/src/groovy/server/README.md) -**Preperation**: In another directory run (Requires Gradle 7 and OpenJDK 17): +### Verification Examples & Usage -```shell -git clone https://github.com/GroovyLanguageServer/groovy-language-server -./gradlew build -``` +None of the verification examples is part of the npm workspace. Some bring substantial amount of npm dependencies that pollute the main node_modules dependencies and therefore these examples need to be build and started independently. All verifaction examples re-uses the code form the json client example and therefore require the json server to be started. -Afterwards copy the jar file from from `groovy-language-server/build/libs/groovy-language-server-all.jar` to `packages/examples/resources/external/groovy` +- [angular verification example](./verify/angular): Before March 2024 this was located in [a separate repository](https://github.com/TypeFox/monaco-languageclient-ng-example). If you want to test it, Please do: `cd verify/angular && npm run verify`. It serves the client here: . -```shell -# start the express server with the language server running as external Java process. -npm run start:example:server:groovy -``` +- [webpack verification example](./verify/webpack) demonstrates how bundling can be achieved with webpack. You find the configuration here: [webpack.config.js](./verify/webpack/webpack.config.js). Please do: `cd verify/webpack && npm run verify`. It serves the client here: . -#### Verification Example Servers +- [vite verification example](./verify/vite) demonstrates how bundling can be achieved with vite. There is no configuration required Please do: `cd verify/vite && npm run verify`. It serves the client here: . -If you want to reach the verification examples from the vite dev server index page you need to run the following additional http-servers beforehand (this is also indicated on the page itself): +- [pnpm verification example](./verify/pnpm) demonstrates that the project can be build with vite, but pnpm is used instead of npm. Please do: `cd verify/pnpm && pnpm run verify`. It serves the client here: . -```shell -# Serve the webpack verification example on http://localhost:8081 -npm run start:verify:webpack -# Serve the vite verification example on http://localhost:8082 -npm run start:verify:vite -``` +- [yarn verification example](./verify/yarn)demonstrates that the project can be build with vite, but yarn is used instead of npm. Please do: `cd verify/yarn && yarn run verify`. It serves the client here: . ### VSCode integration @@ -221,19 +186,12 @@ You can as well run [vscode tasks](./.vscode/launch.json) to start and debug the ### General -Again, if you use **monaco-languageclient** make sure you define matching [Overrides instructions](#overrides-instructions) in your local project to override any mismatching **monaco-editor** or **vscode** versions with you dependency tree. - -Ensure **monaco-editor**, **vscode** and **monaco-languageclient** are imported before you do any **monaco-editor** or vscode-api intialization or start using it. Please check the [our python language client example](./packages/examples/src/python/client/main.ts) to see how it should be done. +Whenever you used `monaco-editor`, `vscode`, `monaco-languageclient`, `monaco-editor-wrapper` or `@typefox/monaco-editor-react` ensure they are imported before you do any `monaco-editor` or `vscode` api related intialization work or start using it. Please check the [our python language client example](./packages/examples/src/python/client/main.ts) to see how it should be done. -### Dependency issues: monaco-editor / @codingame/monaco-editor-treemended +### Dependency issues: monaco-editor / @codingame/monaco-vscode-api / @codingame/monaco-vscode-editor-api -TODO: This section needs to be overhauled - -It is recommended to study this chapter first: [NEW with v7: Treemended monaco-editor](#new-with-v7-treemended-monaco-editor). If you have mutiple, possibly hundreds of compile errors resulting from missing functions deep in `monaco-editor` or `vscode` then it is very likely your `package-lock.json` or `node_modules` are dirty. Remove both and do a fresh `npm install`. Always `npm list monaco-editor` is very useful. If you see different or errornous versions, then this is an indicator something is wrong. -Current observation is: When using npm overrides upgrading them seems to be problematic. Best practices seems to be to remove `package-lock.json` or `node_modules` and do a full re-installation with `npm i` afterwards. - ### Volta There are [Volta](https://volta.sh/) instructions in the `package.json` files. When you have Volta available it will ensure the exactly specified `node` and `npm` versions are used. @@ -242,11 +200,11 @@ There are [Volta](https://volta.sh/) instructions in the `package.json` files. W When you are using vite for development please be aware of [this recommendation](https://github.com/CodinGame/monaco-vscode-api#if-you-use-vite). -If you see the problem *Assertion failed (There is already an extension with this id)* you likely have mismatching dependencies defined for `monaco-editor` or `@codingame/monaco-vscode-api`. You should fix this or add the following entry to your vite config: +If you see the problem *Assertion failed (There is already an extension with this id)* you likely have mismatching dependencies defined for `vscode` / `@codingame/monaco-vscode-api`. You should fix this or add the following entry to your vite config: ```javascript resolve: { - dedupe: ['monaco-editor', 'vscode'] + dedupe: ['vscode'] } ``` @@ -275,35 +233,11 @@ It is very likely you have an old version of `buffer` interfering (see [#538](ht } ``` -### monaco-editor-core - -Originally **monaco-languageclient** was dependent on **monaco-editor-core**, but we changed this with version **1.0.0**. If your project requires to use **monaco-editor-core** and you want to stay compatible with **1.0.0** of **monaco-languageclient** you can install **monaco-editor-core** as **monaco-editor**: +### monaco-editor and react -```shell -npm install monaco-editor@npm:monaco-editor-core -``` +We recommend you now use `typefox/monaco-editor-react`. -Or if you are using **Webpack** you can alternatively add this alias to its config: - -```javascript -resolve: { - alias: { - // This doesn't pull any languages into bundles and works as monaco-editor-core was installed - 'monaco-editor$': 'monaco-editor-core$', - 'monaco-editor/': 'monaco-editor-core/', - } -} -``` - -If you use **monaco-editor** as dependency, but only want to have the content of **monaco-editor-core** than just only import: - -```javascript -import * as monaco from 'monaco-editor/esm/vs/editor/edcore.main.js'; -``` - -### @monaco-editor/react - -Add the **monaco-editor** import at the top of your editor component file [source](https://github.com/suren-atoyan/monaco-react#use-monaco-editor-as-an-npm-package): +But if you need to use `@monaco-editor/react`, then add the `monaco-editor` import at the top of your editor component file [source](https://github.com/suren-atoyan/monaco-react#use-monaco-editor-as-an-npm-package): ```javascript import * as monaco from "monaco-editor"; @@ -314,27 +248,16 @@ loader.config({ monaco }); ### pnpm -If you use pnpm, you have to add `vscode` / `@codingame/monaco-vscode-api` as direct dependency (see the [following table](#monaco-editor--codingamemonaco-vscode-api-compatibility-table)), otherwise the installation will fail. +If you use pnpm, you have to add `vscode` / `@codingame/monaco-vscode-api` as direct dependency (you find the [compatibility table here](https://github.com/TypeFox/monaco-languageclient/blob/main/docs/versions-and-history.md#monaco-editor--codingamemonaco-vscode-api-compatibility-table), otherwise the installation will fail. ```json "vscode": "npm:@codingame/monaco-vscode-api@~3.1.2" ``` -## Monaco-editor / @codingame/monaco-vscode-api compatibility table - -Please see [Version information and project History](./docs/versions-and-history.md#monaco-editor--codingamemonaco-vscode-api-compatibility-table) for a complete overview. - -## Important Project Changes - -[This information has been moved here](./docs/versions-and-history.md#important-project-changes). - -## Changelogs - -CHANGELOG for `monaco-languageclient` is found [here](./packages/client/CHANGELOG.md) - -CHANGELOG for `vscode-ws-jsonrpc` is found [here](./packages/vscode-ws-jsonrpc/CHANGELOG.md) - ## Licenses -- monaco-languageclient: [MIT](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/client/License.txt) -- vscode-ws-jsonrpc: [MIT](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/vscode-ws-jsonrpc/License.txt) +- monaco-languageclient: [MIT](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/client/LICENSE) +- vscode-ws-jsonrpc: [MIT](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/vscode-ws-jsonrpc/LICENSE) +- monaco-editor-wrapper: [MIT](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/wrapper/LICENSE) +- @typefox/monaco-editor-react: [MIT](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/wrapper-react/LICENSE) +- monaco-languageclient-examples: [MIT](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/examples/LICENSE) diff --git a/docs/versions-and-history.md b/docs/versions-and-history.md index 6eb87ae75..5c68a6887 100644 --- a/docs/versions-and-history.md +++ b/docs/versions-and-history.md @@ -47,7 +47,7 @@ The following table describes which version of **monaco-languageclient** and **@ ### March 2024 (v8.0.0) -`@codingame/monaco-editor-treemended` is replaced by self-standing `@codingame/monaco-vscode-editor-api`. All service and editor related functions have been moved from `monaco-languageclient` to `monaco-editor-wrapper` which has been moved into this repository. +`@codingame/monaco-editor-treemended` is replaced by self-standing `@codingame/monaco-vscode-editor-api`. `monaco-editor-wrapper` and `@typefox/monaco-editor-react` have been moved into this repository. ### October 2023 (v7.0.0) diff --git a/packages/client/License.txt b/packages/client/LICENSE similarity index 92% rename from packages/client/License.txt rename to packages/client/LICENSE index 1aebc3426..511fc2eb6 100644 --- a/packages/client/License.txt +++ b/packages/client/LICENSE @@ -1,9 +1,7 @@ -Copyright (c) 2018-2024 TypeFox GmbH (http://www.typefox.io) - -All rights reserved. - MIT License +Copyright 2018 - present TypeFox GmbH + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. diff --git a/packages/client/README.md b/packages/client/README.md index 7b0f3f41f..27e641938 100644 --- a/packages/client/README.md +++ b/packages/client/README.md @@ -8,12 +8,45 @@ Module to connect [Monaco editor](https://microsoft.github.io/monaco-editor/) with [language servers](https://microsoft.github.io/language-server-protocol/). -See [here](https://github.com/TypeFox/monaco-languageclient/blob/main/README.md) for a detailed documentation. +## CHANGELOG + +All changes are noted in the [CHANGELOG](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/client/CHANGELOG.md). + +## Getting Started + +This is npm package is part of the mono repo. Please follow the main repositories [instructions]]() to get started with local development. + +## Usage + +### NEW with v8: Own monaco-vscode-editor-api package + +Since version 2 (see [Important Project Changes](https://github.com/TypeFox/monaco-languageclient/blob/main/docs/versions-and-history.md#important-project-changes)) of this library we rely on [@codingame/monaco-vscode-api](https://github.com/CodinGame/monaco-vscode-api) to supply the vscode API. It evolved substantially since then and thesedays allows to use many vscode only services with `monaco-editor`. With v6 and v7 we "treemend" used a "treemended" version of `monaco-editor` which brought back monaco-editor code that was removed during bundling/threeshaking (*treemending*). This left users with the need to define overrides / resolution which was problematic. +Therefore [monaco-vscode-editor-api](https://www.npmjs.com/package/@codingame/monaco-editor-wrapper) is now used and installed as an alias to `monaco-editor` because it provides the same api as the official monaco-editor. + +### Using services and extra packages from @codingame/monaco-vscode-api -## History +The bespoke projects not only supplies the api, but it provides 100+ packages with additional services, default extensions and language packs. By default when initalizing `monaco-languageclient` via the required `initServices` the following services are always loaded: -For the history please see the [README](https://github.com/TypeFox/monaco-languageclient/blob/main/README.md#latest-important-project-changes) and [CHANGELOG](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/client/CHANGELOG.md). +- *languages* and model *services* (always added by `monaco-languagclient`) +- *layout*, *environment*, *extension*, *files* and *quickAccess* (always added by `monaco-vscode-api`) + +Please check the [following link](https://github.com/CodinGame/monaco-vscode-api#monaco-standalone-services) for information about all services supplied by [@codingame/monaco-vscode-api](https://github.com/CodinGame/monaco-vscode-api). + +Please check our examples [in the examples overview chapter](https://github.com/TypeFox/monaco-languageclient/tree/main?tab=readme-ov-file#examples-overview) as they demonstrate the usage. + +#### textmate and monarch + +If you use the `textmate` or `theme` services you are able to load textmate based grammars and theme definitions from vscode: + +```js +import getThemeServiceOverride from '@codingame/monaco-vscode-theme-service-override'; +import getTextmateServiceOverride from '@codingame/monaco-vscode-textmate-service-override'; +``` + +Once you those services you can no longer make use of monarch based grammars and themes. + +See [here](https://github.com/TypeFox/monaco-languageclient/blob/main/README.md) for a detailed documentation. ## License -[MIT](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/client/License.txt) +[MIT](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/client/LICENSE) diff --git a/packages/client/package.json b/packages/client/package.json index 75a3cc43a..25431b4dd 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -52,7 +52,7 @@ "src", "README.md", "CHANGELOG.md", - "License.txt" + "LICENSE" ], "dependencies": { "@codingame/monaco-vscode-languages-service-override": "~3.1.2", diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts index 534c8ae05..93a91192a 100644 --- a/packages/client/src/index.ts +++ b/packages/client/src/index.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { BaseLanguageClient, MessageTransports, LanguageClientOptions } from 'vscode-languageclient/lib/common/client.js'; diff --git a/packages/client/src/vscode/services.ts b/packages/client/src/vscode/services.ts index 70d923f83..4b8f7929e 100644 --- a/packages/client/src/vscode/services.ts +++ b/packages/client/src/vscode/services.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { editor, Environment } from 'monaco-editor'; diff --git a/packages/examples/License.txt b/packages/examples/LICENSE similarity index 92% rename from packages/examples/License.txt rename to packages/examples/LICENSE index 1aebc3426..47ca2850d 100644 --- a/packages/examples/License.txt +++ b/packages/examples/LICENSE @@ -1,9 +1,7 @@ -Copyright (c) 2018-2024 TypeFox GmbH (http://www.typefox.io) - -All rights reserved. - MIT License +Copyright 2023 - present TypeFox GmbH + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. diff --git a/packages/examples/README.md b/packages/examples/README.md index c8294eeca..2a9b68992 100644 --- a/packages/examples/README.md +++ b/packages/examples/README.md @@ -12,6 +12,14 @@ This package contains [all examples from the monaco-languageclient repository](h All changes are noted in the [CHANGELOG](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/examples/CHANGELOG.md). +## Getting Started + +This is npm package is part of the mono repo. Please follow the main repositories [instructions]]() to get started with local development. + +## Usage + +Needs to be added. + ## License -[MIT](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/examples/License.txt) +[MIT](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/examples/LICENSE) diff --git a/packages/examples/package.json b/packages/examples/package.json index 97bd36e2a..fac65e48b 100644 --- a/packages/examples/package.json +++ b/packages/examples/package.json @@ -106,7 +106,7 @@ "*.ts", "README.md", "CHANGELOG.md", - "License.txt" + "LICENSE" ], "scripts": { "clean": "shx rm -fr dist *.tsbuildinfo", diff --git a/packages/examples/src/browser/main.ts b/packages/examples/src/browser/main.ts index 4d3b24bbf..aee008998 100644 --- a/packages/examples/src/browser/main.ts +++ b/packages/examples/src/browser/main.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import * as vscode from 'vscode'; diff --git a/packages/examples/src/common/example-apps-common.ts b/packages/examples/src/common/example-apps-common.ts index ff1af2d28..47663ab42 100644 --- a/packages/examples/src/common/example-apps-common.ts +++ b/packages/examples/src/common/example-apps-common.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { ModelUpdate, MonacoEditorLanguageClientWrapper, UserConfig } from 'monaco-editor-wrapper'; diff --git a/packages/examples/src/common/language-server-runner.ts b/packages/examples/src/common/language-server-runner.ts index ab878ed5b..616f67736 100644 --- a/packages/examples/src/common/language-server-runner.ts +++ b/packages/examples/src/common/language-server-runner.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { WebSocketServer } from 'ws'; diff --git a/packages/examples/src/common/server-commons.ts b/packages/examples/src/common/server-commons.ts index 151dbf32a..d24d6718e 100644 --- a/packages/examples/src/common/server-commons.ts +++ b/packages/examples/src/common/server-commons.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { WebSocketServer, ServerOptions } from 'ws'; import { IncomingMessage, Server } from 'http'; diff --git a/packages/examples/src/groovy/client/main.ts b/packages/examples/src/groovy/client/main.ts index b34b1a4f4..e89cae661 100644 --- a/packages/examples/src/groovy/client/main.ts +++ b/packages/examples/src/groovy/client/main.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override'; diff --git a/packages/examples/src/groovy/config.ts b/packages/examples/src/groovy/config.ts index 62885f797..f2c7ac9d3 100644 --- a/packages/examples/src/groovy/config.ts +++ b/packages/examples/src/groovy/config.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ export const groovyConfig = { port: 30002, diff --git a/packages/examples/src/groovy/server/README.md b/packages/examples/src/groovy/server/README.md new file mode 100644 index 000000000..85b07c638 --- /dev/null +++ b/packages/examples/src/groovy/server/README.md @@ -0,0 +1,19 @@ +# Groovy Language Server self-built instructions + +## Preperation + +In another directory run (Requires Gradle 7 and OpenJDK 17) + +```shell +git clone https://github.com/GroovyLanguageServer/groovy-language-server +./gradlew build +``` + +Afterwards copy the jar file from from `groovy-language-server/build/libs/groovy-language-server-all.jar` to `packages/examples/resources/external/groovy`. + +From the root of this repository run: + +```shell +# start the express server with the language server running as external Java process. +npm run start:example:server:groovy +``` diff --git a/packages/examples/src/groovy/server/direct.ts b/packages/examples/src/groovy/server/direct.ts index 34f021301..98d042711 100644 --- a/packages/examples/src/groovy/server/direct.ts +++ b/packages/examples/src/groovy/server/direct.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { resolve } from 'path'; diff --git a/packages/examples/src/groovy/server/main.ts b/packages/examples/src/groovy/server/main.ts index f30fc5e4e..eb1eab118 100644 --- a/packages/examples/src/groovy/server/main.ts +++ b/packages/examples/src/groovy/server/main.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { runLanguageServer } from '../../common/language-server-runner.js'; diff --git a/packages/examples/src/index.ts b/packages/examples/src/index.ts index bffbb4f7c..d9472e18a 100644 --- a/packages/examples/src/index.ts +++ b/packages/examples/src/index.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ /* client side export only */ diff --git a/packages/examples/src/json/client/wrapperWs.ts b/packages/examples/src/json/client/wrapperWs.ts index f2c23ff94..ca44df642 100644 --- a/packages/examples/src/json/client/wrapperWs.ts +++ b/packages/examples/src/json/client/wrapperWs.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override'; diff --git a/packages/examples/src/json/server/direct.ts b/packages/examples/src/json/server/direct.ts index 3ff8be665..e82c3d69e 100644 --- a/packages/examples/src/json/server/direct.ts +++ b/packages/examples/src/json/server/direct.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { resolve } from 'path'; import { runJsonServer } from './main.js'; diff --git a/packages/examples/src/json/server/json-server.ts b/packages/examples/src/json/server/json-server.ts index 2affb02d5..0917082e4 100644 --- a/packages/examples/src/json/server/json-server.ts +++ b/packages/examples/src/json/server/json-server.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { readFile } from 'fs'; import requestLight from 'request-light'; diff --git a/packages/examples/src/json/server/main.ts b/packages/examples/src/json/server/main.ts index 59bfc1c42..6302018e3 100644 --- a/packages/examples/src/json/server/main.ts +++ b/packages/examples/src/json/server/main.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { runLanguageServer } from '../../common/language-server-runner.js'; import { resolve } from 'path'; diff --git a/packages/examples/src/langium/langium-dsl/config/classicConfig.ts b/packages/examples/src/langium/langium-dsl/config/classicConfig.ts index 971f8db23..244cd718d 100644 --- a/packages/examples/src/langium/langium-dsl/config/classicConfig.ts +++ b/packages/examples/src/langium/langium-dsl/config/classicConfig.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { Uri } from 'vscode'; diff --git a/packages/examples/src/langium/langium-dsl/config/extendedConfig.ts b/packages/examples/src/langium/langium-dsl/config/extendedConfig.ts index 8ad79bb26..232e2ea58 100644 --- a/packages/examples/src/langium/langium-dsl/config/extendedConfig.ts +++ b/packages/examples/src/langium/langium-dsl/config/extendedConfig.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import getEditorServiceOverride from '@codingame/monaco-vscode-editor-service-override'; diff --git a/packages/examples/src/langium/langium-dsl/config/langium.monarch.ts b/packages/examples/src/langium/langium-dsl/config/langium.monarch.ts index 712f9950b..08b4d7122 100644 --- a/packages/examples/src/langium/langium-dsl/config/langium.monarch.ts +++ b/packages/examples/src/langium/langium-dsl/config/langium.monarch.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ export const LangiumMonarchContent = { diff --git a/packages/examples/src/langium/langium-dsl/worker/langium-server.ts b/packages/examples/src/langium/langium-dsl/worker/langium-server.ts index 3787a092d..534e3b2c1 100644 --- a/packages/examples/src/langium/langium-dsl/worker/langium-server.ts +++ b/packages/examples/src/langium/langium-dsl/worker/langium-server.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { EmptyFileSystem } from 'langium'; diff --git a/packages/examples/src/langium/langium-dsl/wrapperLangium.ts b/packages/examples/src/langium/langium-dsl/wrapperLangium.ts index 47a2ed944..c279c11af 100644 --- a/packages/examples/src/langium/langium-dsl/wrapperLangium.ts +++ b/packages/examples/src/langium/langium-dsl/wrapperLangium.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { MonacoEditorLanguageClientWrapper } from 'monaco-editor-wrapper'; diff --git a/packages/examples/src/langium/statemachine/config/wrapperStatemachineConfig.ts b/packages/examples/src/langium/statemachine/config/wrapperStatemachineConfig.ts index 946b4a17f..590172b94 100644 --- a/packages/examples/src/langium/statemachine/config/wrapperStatemachineConfig.ts +++ b/packages/examples/src/langium/statemachine/config/wrapperStatemachineConfig.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import getEditorServiceOverride from '@codingame/monaco-vscode-editor-service-override'; diff --git a/packages/examples/src/langium/statemachine/main-react.tsx b/packages/examples/src/langium/statemachine/main-react.tsx index 0a20860bb..d132c8746 100644 --- a/packages/examples/src/langium/statemachine/main-react.tsx +++ b/packages/examples/src/langium/statemachine/main-react.tsx @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import React from 'react'; diff --git a/packages/examples/src/langium/statemachine/main.ts b/packages/examples/src/langium/statemachine/main.ts index b7c3d0a45..2b00c367d 100644 --- a/packages/examples/src/langium/statemachine/main.ts +++ b/packages/examples/src/langium/statemachine/main.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import * as vscode from 'vscode'; diff --git a/packages/examples/src/langium/statemachine/worker/statemachine-server-port.ts b/packages/examples/src/langium/statemachine/worker/statemachine-server-port.ts index bfa45a32d..8890d4bcf 100644 --- a/packages/examples/src/langium/statemachine/worker/statemachine-server-port.ts +++ b/packages/examples/src/langium/statemachine/worker/statemachine-server-port.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { start } from './statemachine-server-start.js'; diff --git a/packages/examples/src/langium/statemachine/worker/statemachine-server-start.ts b/packages/examples/src/langium/statemachine/worker/statemachine-server-start.ts index cf011a0f6..e35a1e444 100644 --- a/packages/examples/src/langium/statemachine/worker/statemachine-server-start.ts +++ b/packages/examples/src/langium/statemachine/worker/statemachine-server-start.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { EmptyFileSystem } from 'langium'; diff --git a/packages/examples/src/langium/statemachine/worker/statemachine-server.ts b/packages/examples/src/langium/statemachine/worker/statemachine-server.ts index 55e63a65c..3d08d16b9 100644 --- a/packages/examples/src/langium/statemachine/worker/statemachine-server.ts +++ b/packages/examples/src/langium/statemachine/worker/statemachine-server.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { start } from './statemachine-server-start.js'; diff --git a/packages/examples/src/node.ts b/packages/examples/src/node.ts index 73472083f..2a722dc96 100644 --- a/packages/examples/src/node.ts +++ b/packages/examples/src/node.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ /* server side export only */ diff --git a/packages/examples/src/python/client/config.ts b/packages/examples/src/python/client/config.ts index 9a42b5273..88f46cc5e 100644 --- a/packages/examples/src/python/client/config.ts +++ b/packages/examples/src/python/client/config.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import * as vscode from 'vscode'; diff --git a/packages/examples/src/python/client/main.ts b/packages/examples/src/python/client/main.ts index 69c979e7f..00c951a3c 100644 --- a/packages/examples/src/python/client/main.ts +++ b/packages/examples/src/python/client/main.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import * as vscode from 'vscode'; diff --git a/packages/examples/src/python/client/reactPython.tsx b/packages/examples/src/python/client/reactPython.tsx index 46cf4c96c..ac4138b9a 100644 --- a/packages/examples/src/python/client/reactPython.tsx +++ b/packages/examples/src/python/client/reactPython.tsx @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import React from 'react'; diff --git a/packages/examples/src/python/server/direct.ts b/packages/examples/src/python/server/direct.ts index 507e2a0d8..c242e15e8 100644 --- a/packages/examples/src/python/server/direct.ts +++ b/packages/examples/src/python/server/direct.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { resolve } from 'path'; diff --git a/packages/examples/src/python/server/main.ts b/packages/examples/src/python/server/main.ts index bdea51f3d..be979dd59 100644 --- a/packages/examples/src/python/server/main.ts +++ b/packages/examples/src/python/server/main.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { resolve } from 'path'; diff --git a/packages/examples/src/ts/wrapperAdvanced.ts b/packages/examples/src/ts/wrapperAdvanced.ts index e04b8b811..3935bae2f 100644 --- a/packages/examples/src/ts/wrapperAdvanced.ts +++ b/packages/examples/src/ts/wrapperAdvanced.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override'; diff --git a/packages/examples/src/ts/wrapperTs.ts b/packages/examples/src/ts/wrapperTs.ts index 49f7689a6..a03af62ba 100644 --- a/packages/examples/src/ts/wrapperTs.ts +++ b/packages/examples/src/ts/wrapperTs.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import * as vscode from 'vscode'; diff --git a/packages/examples/src/utils/fs-utils.ts b/packages/examples/src/utils/fs-utils.ts index 339183f0b..157209521 100644 --- a/packages/examples/src/utils/fs-utils.ts +++ b/packages/examples/src/utils/fs-utils.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { dirname } from 'path'; import { fileURLToPath } from 'url'; diff --git a/packages/examples/src/utils/localeLoader.ts b/packages/examples/src/utils/localeLoader.ts index 4b123386d..1b267513d 100644 --- a/packages/examples/src/utils/localeLoader.ts +++ b/packages/examples/src/utils/localeLoader.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ const locale = new URLSearchParams(window.location.search).get('locale'); diff --git a/packages/vscode-ws-jsonrpc/License.txt b/packages/vscode-ws-jsonrpc/LICENSE similarity index 92% rename from packages/vscode-ws-jsonrpc/License.txt rename to packages/vscode-ws-jsonrpc/LICENSE index 1aebc3426..511fc2eb6 100644 --- a/packages/vscode-ws-jsonrpc/License.txt +++ b/packages/vscode-ws-jsonrpc/LICENSE @@ -1,9 +1,7 @@ -Copyright (c) 2018-2024 TypeFox GmbH (http://www.typefox.io) - -All rights reserved. - MIT License +Copyright 2018 - present TypeFox GmbH + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. diff --git a/packages/vscode-ws-jsonrpc/README.md b/packages/vscode-ws-jsonrpc/README.md index 6d5195456..7a6a48fd6 100644 --- a/packages/vscode-ws-jsonrpc/README.md +++ b/packages/vscode-ws-jsonrpc/README.md @@ -2,12 +2,17 @@ NPM module to implement communication between a jsonrpc client and server over WebSocket. -See the following example code how to use this library or take a look of the `monaco-languageclient` and `vscode-ws-jsonrpc` examples here: +## CHANGELOG -- [client](/packages/examples/src/client) -- [server](/packages/examples/src/server) +All changes are noted in the [CHANGELOG](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/vscode-ws-jsonrpc/CHANGELOG.md). -## Client side connection handling +## Getting Started + +This is npm package is part of the mono repo. Please follow the main repositories [instructions]]() to get started with local development. + +## Usage + +### Client side connection handling ```ts import { MessageConnection, NotificationType } from 'vscode-jsonrpc'; @@ -24,7 +29,7 @@ listen({ }); ``` -## Server side connection handling +### Server side connection handling ```ts import { createWebSocketConnection, ConsoleLogger, IWebSocket } from 'vscode-ws-jsonrpc'; @@ -41,7 +46,7 @@ connection.onNotification(notification, (param: string) => { connection.listen(); ``` -## Server side connection forwarding +### Server side connection forwarding ```ts import { IWebSocket, WebSocketMessageReader, WebSocketMessageWriter } from 'vscode-ws-jsonrpc'; @@ -63,10 +68,10 @@ forward(socketConnection, serverConnection, message => { }); ``` -## History +### Further examples -For the history please see the [README](https://github.com/TypeFox/monaco-languageclient/blob/main/README.md#latest-important-project-changes) and [CHANGELOG](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/vscode-ws-jsonrpc/CHANGELOG.md). +For a detailed list of examples please look at [this section]() in the main repository. ## License -[MIT](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/vscode-ws-jsonrpc/License.txt) +[MIT](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/vscode-ws-jsonrpc/LICENSE) diff --git a/packages/vscode-ws-jsonrpc/package.json b/packages/vscode-ws-jsonrpc/package.json index d42bfaea7..ef771f44f 100644 --- a/packages/vscode-ws-jsonrpc/package.json +++ b/packages/vscode-ws-jsonrpc/package.json @@ -59,7 +59,7 @@ "src", "README.md", "CHANGELOG.md", - "License.txt" + "LICENSE" ], "dependencies": { "vscode-jsonrpc": "~8.2.0" diff --git a/packages/vscode-ws-jsonrpc/src/connection.ts b/packages/vscode-ws-jsonrpc/src/connection.ts index 2de28fbf9..8118fd013 100644 --- a/packages/vscode-ws-jsonrpc/src/connection.ts +++ b/packages/vscode-ws-jsonrpc/src/connection.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { MessageConnection, Logger } from 'vscode-jsonrpc'; diff --git a/packages/vscode-ws-jsonrpc/src/disposable.ts b/packages/vscode-ws-jsonrpc/src/disposable.ts index c499a6d3c..6528c892d 100644 --- a/packages/vscode-ws-jsonrpc/src/disposable.ts +++ b/packages/vscode-ws-jsonrpc/src/disposable.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { Disposable } from 'vscode-jsonrpc'; diff --git a/packages/vscode-ws-jsonrpc/src/index.ts b/packages/vscode-ws-jsonrpc/src/index.ts index 006802899..7798b02a5 100644 --- a/packages/vscode-ws-jsonrpc/src/index.ts +++ b/packages/vscode-ws-jsonrpc/src/index.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ export * from './disposable.js'; diff --git a/packages/vscode-ws-jsonrpc/src/logger.ts b/packages/vscode-ws-jsonrpc/src/logger.ts index 772d0fc96..8860b6c29 100644 --- a/packages/vscode-ws-jsonrpc/src/logger.ts +++ b/packages/vscode-ws-jsonrpc/src/logger.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { Logger } from 'vscode-jsonrpc'; diff --git a/packages/vscode-ws-jsonrpc/src/server/connection.ts b/packages/vscode-ws-jsonrpc/src/server/connection.ts index cb23469a2..db8e4bfcc 100644 --- a/packages/vscode-ws-jsonrpc/src/server/connection.ts +++ b/packages/vscode-ws-jsonrpc/src/server/connection.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { MessageReader, MessageWriter, Disposable, Message } from 'vscode-jsonrpc'; diff --git a/packages/vscode-ws-jsonrpc/src/server/index.ts b/packages/vscode-ws-jsonrpc/src/server/index.ts index 3f8d46bd1..eec271779 100644 --- a/packages/vscode-ws-jsonrpc/src/server/index.ts +++ b/packages/vscode-ws-jsonrpc/src/server/index.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ export * from './connection.js'; diff --git a/packages/vscode-ws-jsonrpc/src/server/launch.ts b/packages/vscode-ws-jsonrpc/src/server/launch.ts index ed694a725..6c5452f46 100644 --- a/packages/vscode-ws-jsonrpc/src/server/launch.ts +++ b/packages/vscode-ws-jsonrpc/src/server/launch.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import * as net from 'net'; diff --git a/packages/vscode-ws-jsonrpc/src/socket/connection.ts b/packages/vscode-ws-jsonrpc/src/socket/connection.ts index 6c054e42d..b65b84f0a 100644 --- a/packages/vscode-ws-jsonrpc/src/socket/connection.ts +++ b/packages/vscode-ws-jsonrpc/src/socket/connection.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { MessageConnection, createMessageConnection, Logger } from 'vscode-jsonrpc'; diff --git a/packages/vscode-ws-jsonrpc/src/socket/index.ts b/packages/vscode-ws-jsonrpc/src/socket/index.ts index f17f9b508..34ae49a33 100644 --- a/packages/vscode-ws-jsonrpc/src/socket/index.ts +++ b/packages/vscode-ws-jsonrpc/src/socket/index.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ export * from './socket.js'; diff --git a/packages/vscode-ws-jsonrpc/src/socket/reader.ts b/packages/vscode-ws-jsonrpc/src/socket/reader.ts index ad0dcd93e..a890d8c2c 100644 --- a/packages/vscode-ws-jsonrpc/src/socket/reader.ts +++ b/packages/vscode-ws-jsonrpc/src/socket/reader.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { Disposable } from 'vscode-jsonrpc'; diff --git a/packages/vscode-ws-jsonrpc/src/socket/socket.ts b/packages/vscode-ws-jsonrpc/src/socket/socket.ts index dd28c3e3c..044b7bb3c 100644 --- a/packages/vscode-ws-jsonrpc/src/socket/socket.ts +++ b/packages/vscode-ws-jsonrpc/src/socket/socket.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { Disposable } from 'vscode-jsonrpc'; diff --git a/packages/vscode-ws-jsonrpc/src/socket/writer.ts b/packages/vscode-ws-jsonrpc/src/socket/writer.ts index b2854c150..80216d3c6 100644 --- a/packages/vscode-ws-jsonrpc/src/socket/writer.ts +++ b/packages/vscode-ws-jsonrpc/src/socket/writer.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { Message } from 'vscode-jsonrpc/lib/common/messages.js'; diff --git a/packages/wrapper-react/LICENSE b/packages/wrapper-react/LICENSE index f4f950899..03bbcce05 100644 --- a/packages/wrapper-react/LICENSE +++ b/packages/wrapper-react/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright 2022 TypeFox GmbH +Copyright 2022 - present TypeFox GmbH Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/packages/wrapper-react/README.md b/packages/wrapper-react/README.md index 7608b2b9d..7a9e13c72 100644 --- a/packages/wrapper-react/README.md +++ b/packages/wrapper-react/README.md @@ -1,44 +1,33 @@ # React component for Monaco-Editor and Monaco Languageclient -This packages provides a React component that it based on the [monaco-editor-wrapper](../monaco-editor-wrapper/). It behaves in nearly the same way as the monaco editor, with the primary difference being that you interact with it through a React component. +This packages provides a React component that it based on the [monaco-editor-wrapper](https://www.npmjs.com/package/monaco-editor-wrapper). It behaves nearly the same way as the monaco editor, with the primary difference being that you interact with it through a React component. The [monaco-languageclient](https://github.com/TypeFox/monaco-languageclient) can be activated to connect to a language server either via jsonrpc over a websocket to an exernal server process, or via the Language Server Protocol for the browser where the language server runs in a web worker. -## Getting Started - -We recommend using [Volta](https://volta.sh/) to ensure your node & npm are on known good versions. +## CHANGELOG -If you have node.js LTS available, then from the root of the project run: +All changes are noted in the [CHANGELOG](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/wrapper-react/CHANGELOG.md). -```bash -npm i -npm run build -``` +## Getting Started -This will clean, compile and build a bundle of the monaco-editor-react component, which you can reference in your own projects. +This is npm package is part of the mono repo. Please follow the main repositories [instructions]]() to get started with local development. ## Usage You can import the monaco react component for easy use in an existing React project. Below you can see a quick example of a fully functional implementation in TypeScript. The react component uses the same `UserConfig` approach which is then applied to `monaco-editor-wrapper`. ```typescript -import { MonacoEditorReactComp } from '@typefox/monaco-editor-react'; +import '@codingame/monaco-vscode-python-default-extension'; import { 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'; +import { MonacoEditorReactComp } from '@typefox/monaco-editor-react'; const userConfig: UserConfig = { htmlElement: document.getElementById('monaco-editor-root') as HTMLElement, wrapperConfig: { editorAppConfig: { - $type: 'classic', - languageId: 'typescript', - code: `function sayHello(): string { - return "Hello"; -};`, - useDiffEditor: false, - theme: 'vs-dark' + $type: 'extendend', + languageId: 'python', + code: 'print("Hello, World!")' } } }; @@ -60,15 +49,7 @@ For special cases you might want the component to be processed in advance. For t import { MonacoEditorReactComp } from '@typefox/monaco-editor-react/bundle'; ``` -## Examples - -These are the examples specifically for `@typefox/monaco-editor-react` that you can find in the repository: - -- 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) - -## Invoking Custom Commands +### Invoking Custom Commands *An experimental feature.* @@ -99,3 +80,11 @@ this.myRef.current.executeCommand('myCustomCommand', args...); ``` This will return an instance of `Thenable`, which should contain the returned data of executing your custom command. As you can imagine, this is incredibly helpful for getting internal access for specific language handling, but without needing details about the internals of your language server to do it. + +## Examples + +For a detailed list of examples please look at [this section]() in the main repository. + +## License + +[MIT](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/wrapper-react/LICENSE) diff --git a/packages/wrapper-react/package.json b/packages/wrapper-react/package.json index c784d269c..265f69c56 100644 --- a/packages/wrapper-react/package.json +++ b/packages/wrapper-react/package.json @@ -36,8 +36,9 @@ "dist", "bundle", "src", - "LICENSE", - "README.md" + "README.md", + "CHANGELOG.md", + "LICENSE" ], "scripts": { "clean": "shx rm -rf ./dist ./bundle *.tsbuildinfo", diff --git a/packages/wrapper-react/src/index.tsx b/packages/wrapper-react/src/index.tsx index 562dafb86..0656515f2 100644 --- a/packages/wrapper-react/src/index.tsx +++ b/packages/wrapper-react/src/index.tsx @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { EditorAppClassic, EditorAppExtended, MonacoEditorLanguageClientWrapper, UserConfig, WorkerConfigDirect, WorkerConfigOptions } from 'monaco-editor-wrapper'; diff --git a/packages/wrapper-react/vite.bundle.config.ts b/packages/wrapper-react/vite.bundle.config.ts index 5649d6756..54e6d10a1 100644 --- a/packages/wrapper-react/vite.bundle.config.ts +++ b/packages/wrapper-react/vite.bundle.config.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { defineConfig } from 'vite'; diff --git a/packages/wrapper/LICENSE b/packages/wrapper/LICENSE index f4f950899..03bbcce05 100644 --- a/packages/wrapper/LICENSE +++ b/packages/wrapper/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright 2022 TypeFox GmbH +Copyright 2022 - present TypeFox GmbH Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/packages/wrapper/README.md b/packages/wrapper/README.md index f7f6ead31..6d5a00010 100644 --- a/packages/wrapper/README.md +++ b/packages/wrapper/README.md @@ -2,18 +2,13 @@ This packages provides a wrapped `monaco-editor` with or without language support (main package export). The `monaco-languageclient` can be activated to connect to a language server either via jsonrpc over a websocket to an external server process or via language server protocol for browser where the language server runs in a web worker. -## Getting Started - -We recommend using [Volta](https://volta.sh/) to ensure your node & npm are on known good versions. +## CHANGELOG -If you have node.js LTS available, then from the root of the project run: +All changes are noted in the [CHANGELOG](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/wrapper/CHANGELOG.md). -```bash -npm i -npm run build -``` +## Getting Started -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. +This is npm package is part of the mono repo. Please follow the main repositories [instructions]]() to get started with local development. ## Configuration @@ -53,23 +48,18 @@ Monarch grammars and themes can only be used in **classic** mode and textmate gr Monaco Editor with TypeScript language support in web worker and relying on classic mode: ```ts +import '@codingame/monaco-vscode-python-default-extension'; 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'; // no top-level await const run = async () => { const wrapper = new MonacoEditorLanguageClientWrapper(); - const code: `function sayHello(): string { - return "Hello"; -};`, const userConfig = { wrapperConfig: { editorAppConfig: { - $type: 'classic', - languageId: 'typescript', - code, - useDiffEditor: false, + $type: 'extendend', + languageId: 'python', + code: 'print("Hello, World!")' } } }; @@ -79,12 +69,18 @@ const run = async () => { } ``` +### Bundled Usage + +For special cases you might want the component to be processed in advance. For these cases we provide a pre-bundled version that you can reference instead, built using `npm run build:bundle`. This can be helpful if you're working within some other framework besides React (Hugo for example). + +```ts +import { MonacoEditorLanguageClientWrapper } from 'monaco-editor-wrapper/bundle'; +``` + ## Examples -These are the examples specifically for `monaco-editor-wrapper` you find in the repository: +For a detailed list of examples please look at [this section]() in the main repository. + +## License -- 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) +[MIT](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/wrapper/LICENSE) diff --git a/packages/wrapper/build/buildAllWorkers.mts b/packages/wrapper/build/buildAllWorkers.mts index 2a1d9d580..3a3442bb6 100644 --- a/packages/wrapper/build/buildAllWorkers.mts +++ b/packages/wrapper/build/buildAllWorkers.mts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { bundleWorker } from './buildWorker.mjs'; diff --git a/packages/wrapper/build/buildWorker.mts b/packages/wrapper/build/buildWorker.mts index 1fea69974..5f06ac742 100644 --- a/packages/wrapper/build/buildWorker.mts +++ b/packages/wrapper/build/buildWorker.mts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { dirname, resolve } from 'path'; diff --git a/packages/wrapper/build/vite.cssWorker.ts b/packages/wrapper/build/vite.cssWorker.ts index e4ff865da..c46cde434 100644 --- a/packages/wrapper/build/vite.cssWorker.ts +++ b/packages/wrapper/build/vite.cssWorker.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import path from 'path'; diff --git a/packages/wrapper/build/vite.editorWorker.ts b/packages/wrapper/build/vite.editorWorker.ts index 136362ad5..75dc1f9b6 100644 --- a/packages/wrapper/build/vite.editorWorker.ts +++ b/packages/wrapper/build/vite.editorWorker.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import path from 'path'; diff --git a/packages/wrapper/build/vite.htmlWorker.ts b/packages/wrapper/build/vite.htmlWorker.ts index 9abb0f965..520668a41 100644 --- a/packages/wrapper/build/vite.htmlWorker.ts +++ b/packages/wrapper/build/vite.htmlWorker.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import path from 'path'; diff --git a/packages/wrapper/build/vite.jsonWorker.ts b/packages/wrapper/build/vite.jsonWorker.ts index 7451cb065..79e984e7e 100644 --- a/packages/wrapper/build/vite.jsonWorker.ts +++ b/packages/wrapper/build/vite.jsonWorker.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import path from 'path'; diff --git a/packages/wrapper/build/vite.tsWorker.ts b/packages/wrapper/build/vite.tsWorker.ts index 6ca50fa5a..03494fe2f 100644 --- a/packages/wrapper/build/vite.tsWorker.ts +++ b/packages/wrapper/build/vite.tsWorker.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import path from 'path'; diff --git a/packages/wrapper/package.json b/packages/wrapper/package.json index 67db899c5..600b545a5 100644 --- a/packages/wrapper/package.json +++ b/packages/wrapper/package.json @@ -80,13 +80,14 @@ "dist", "bundle", "src", - "LICENSE", - "README.md" + "README.md", + "CHANGELOG.md", + "LICENSE" ], "scripts": { "clean": "shx rm -rf ./dist ./bundle *.tsbuildinfo", "compile": "tsc --build tsconfig.src.json && tsc --build tsconfig.test.json", - "bundle": "vite --config vite.bundle.config.ts build", + "build:bundle": "vite --config vite.bundle.config.ts build", "build:worker:editor": "vite -c ./build/vite.editorWorker.ts build", "build:worker:ts": "vite -c ./build/vite.tsWorker.ts build", "build:worker:html": "vite -c ./build/vite.htmlWorker.ts build", @@ -94,7 +95,7 @@ "build:worker:json": "vite -c ./build/vite.jsonWorker.ts build", "build:workers:vite": "npm run build:worker:editor && npm run build:worker:ts && npm run build:worker:html && npm run build:worker:css && npm run build:worker:json", "build:workers:esbuild": "vite-node ./build/buildAllWorkers.mts", - "build": "npm run clean && npm run compile && npm run build:workers:esbuild && npm run build:workers:vite && npm run bundle" + "build": "npm run clean && npm run compile && npm run build:workers:esbuild && npm run build:workers:vite && npm run build:bundle" }, "volta": { "node": "20.11.1", diff --git a/packages/wrapper/src/commonTypes.ts b/packages/wrapper/src/commonTypes.ts index 2e342964e..f619cfd0a 100644 --- a/packages/wrapper/src/commonTypes.ts +++ b/packages/wrapper/src/commonTypes.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { MonacoLanguageClient } from 'monaco-languageclient'; diff --git a/packages/wrapper/src/editorAppBase.ts b/packages/wrapper/src/editorAppBase.ts index 9cff35fae..8e00398ec 100644 --- a/packages/wrapper/src/editorAppBase.ts +++ b/packages/wrapper/src/editorAppBase.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { editor, Uri } from 'monaco-editor'; diff --git a/packages/wrapper/src/editorAppClassic.ts b/packages/wrapper/src/editorAppClassic.ts index dad66ce51..a017c87e9 100644 --- a/packages/wrapper/src/editorAppClassic.ts +++ b/packages/wrapper/src/editorAppClassic.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { editor, languages } from 'monaco-editor'; diff --git a/packages/wrapper/src/editorAppExtended.ts b/packages/wrapper/src/editorAppExtended.ts index 962cc3934..ecd1d6b61 100644 --- a/packages/wrapper/src/editorAppExtended.ts +++ b/packages/wrapper/src/editorAppExtended.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import type * as vscode from 'vscode'; diff --git a/packages/wrapper/src/index.ts b/packages/wrapper/src/index.ts index d67e53996..6a720643c 100644 --- a/packages/wrapper/src/index.ts +++ b/packages/wrapper/src/index.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { diff --git a/packages/wrapper/src/languageClientWrapper.ts b/packages/wrapper/src/languageClientWrapper.ts index 2d74d1d6d..1e1a72088 100644 --- a/packages/wrapper/src/languageClientWrapper.ts +++ b/packages/wrapper/src/languageClientWrapper.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { MonacoLanguageClient, IConnectionProvider } from 'monaco-languageclient'; diff --git a/packages/wrapper/src/logger.ts b/packages/wrapper/src/logger.ts index 6654e8d61..33d704650 100644 --- a/packages/wrapper/src/logger.ts +++ b/packages/wrapper/src/logger.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ export type LoggerConfig = { diff --git a/packages/wrapper/src/utils.ts b/packages/wrapper/src/utils.ts index e37d6e329..3015383fd 100644 --- a/packages/wrapper/src/utils.ts +++ b/packages/wrapper/src/utils.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { WebSocketConfigOptions, WebSocketConfigOptionsUrl } from './commonTypes.js'; diff --git a/packages/wrapper/src/vscode/services.ts b/packages/wrapper/src/vscode/services.ts index 97505d6b9..dc4aab1bf 100644 --- a/packages/wrapper/src/vscode/services.ts +++ b/packages/wrapper/src/vscode/services.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { editor, Uri } from 'monaco-editor'; diff --git a/packages/wrapper/src/workerFactory.ts b/packages/wrapper/src/workerFactory.ts index 8a71bc14e..10ef6f08d 100644 --- a/packages/wrapper/src/workerFactory.ts +++ b/packages/wrapper/src/workerFactory.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { initEnhancedMonacoEnvironment } from 'monaco-languageclient/vscode/services'; diff --git a/packages/wrapper/src/wrapper.ts b/packages/wrapper/src/wrapper.ts index e9e880025..5816a09c6 100644 --- a/packages/wrapper/src/wrapper.ts +++ b/packages/wrapper/src/wrapper.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { editor } from 'monaco-editor'; @@ -46,8 +46,9 @@ export class MonacoEditorLanguageClientWrapper { if (this.initDone) { throw new Error('init was already performed. Please call dispose first if you want to re-start.'); } - if (userConfig.wrapperConfig.editorAppConfig.useDiffEditor && !userConfig.wrapperConfig.editorAppConfig.codeOriginal) { - throw new Error('Use diff editor was used without a valid config.'); + const editorAppConfig = userConfig.wrapperConfig.editorAppConfig; + if (editorAppConfig.useDiffEditor && !editorAppConfig.codeOriginal) { + throw new Error(`Use diff editor was used without a valid config. code: ${editorAppConfig.code} codeOriginal: ${editorAppConfig.codeOriginal}`); } // Always dispose old instances before start this.editorApp?.disposeApp(); @@ -55,7 +56,7 @@ export class MonacoEditorLanguageClientWrapper { this.id = userConfig.id ?? Math.floor(Math.random() * 101).toString(); this.logger = new Logger(userConfig.loggerConfig); - if (userConfig.wrapperConfig.editorAppConfig.$type === 'classic') { + if (editorAppConfig.$type === 'classic') { this.editorApp = new EditorAppClassic(this.id, userConfig, this.logger); } else { this.editorApp = new EditorAppExtended(this.id, userConfig, this.logger); diff --git a/packages/wrapper/test/editorAppBase.test.ts b/packages/wrapper/test/editorAppBase.test.ts index 9f9c1b0c2..f37e4bbc2 100644 --- a/packages/wrapper/test/editorAppBase.test.ts +++ b/packages/wrapper/test/editorAppBase.test.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { describe, expect, test } from 'vitest'; diff --git a/packages/wrapper/test/editorAppClassic.test.ts b/packages/wrapper/test/editorAppClassic.test.ts index 6dcbf3c0d..22e7f31d4 100644 --- a/packages/wrapper/test/editorAppClassic.test.ts +++ b/packages/wrapper/test/editorAppClassic.test.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { describe, expect, test } from 'vitest'; diff --git a/packages/wrapper/test/editorAppExtended.test.ts b/packages/wrapper/test/editorAppExtended.test.ts index 5c1701567..c1367eeb5 100644 --- a/packages/wrapper/test/editorAppExtended.test.ts +++ b/packages/wrapper/test/editorAppExtended.test.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { describe, expect, test } from 'vitest'; diff --git a/packages/wrapper/test/helper.ts b/packages/wrapper/test/helper.ts index 459f96174..d5fe4a3fb 100644 --- a/packages/wrapper/test/helper.ts +++ b/packages/wrapper/test/helper.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { UserConfig, EditorAppType, EditorAppExtended, MonacoEditorLanguageClientWrapper } from 'monaco-editor-wrapper'; diff --git a/packages/wrapper/test/languageClientWrapper.test.ts b/packages/wrapper/test/languageClientWrapper.test.ts index ffb5d32b7..782f2f487 100644 --- a/packages/wrapper/test/languageClientWrapper.test.ts +++ b/packages/wrapper/test/languageClientWrapper.test.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { describe, expect, test } from 'vitest'; diff --git a/packages/wrapper/test/logger.test.ts b/packages/wrapper/test/logger.test.ts index f878c0a5d..ddc96cd4f 100644 --- a/packages/wrapper/test/logger.test.ts +++ b/packages/wrapper/test/logger.test.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { describe, expect, test } from 'vitest'; diff --git a/packages/wrapper/test/utils.test.ts b/packages/wrapper/test/utils.test.ts index ad67caa73..7e1caeecd 100644 --- a/packages/wrapper/test/utils.test.ts +++ b/packages/wrapper/test/utils.test.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { describe, expect, test } from 'vitest'; diff --git a/packages/wrapper/test/wrapper.test.ts b/packages/wrapper/test/wrapper.test.ts index b13623917..77ee40e49 100644 --- a/packages/wrapper/test/wrapper.test.ts +++ b/packages/wrapper/test/wrapper.test.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { describe, expect, test } from 'vitest'; diff --git a/packages/wrapper/vite.bundle.config.ts b/packages/wrapper/vite.bundle.config.ts index 0eb0fadcf..ca26bc2f3 100644 --- a/packages/wrapper/vite.bundle.config.ts +++ b/packages/wrapper/vite.bundle.config.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { defineConfig } from 'vite'; diff --git a/verify/angular/custom-webpack.config.js b/verify/angular/custom-webpack.config.js index dd0ccb148..37315dd30 100644 --- a/verify/angular/custom-webpack.config.js +++ b/verify/angular/custom-webpack.config.js @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ // solve: __dirname is not defined in ES module scope diff --git a/verify/angular/src/app/app.component.ts b/verify/angular/src/app/app.component.ts index 03d75c795..6018757e5 100644 --- a/verify/angular/src/app/app.component.ts +++ b/verify/angular/src/app/app.component.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { AfterViewInit, Component } from '@angular/core'; diff --git a/verify/angular/src/app/app.module.ts b/verify/angular/src/app/app.module.ts index bba530975..d122288c5 100644 --- a/verify/angular/src/app/app.module.ts +++ b/verify/angular/src/app/app.module.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2023 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { NgModule } from '@angular/core'; diff --git a/verify/angular/src/main.ts b/verify/angular/src/main.ts index 669e3d539..b4d23d4cf 100644 --- a/verify/angular/src/main.ts +++ b/verify/angular/src/main.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2023 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; diff --git a/verify/buildAll.ps1 b/verify/buildAll.ps1 index e50717d36..9af977dc9 100644 --- a/verify/buildAll.ps1 +++ b/verify/buildAll.ps1 @@ -4,4 +4,4 @@ Set-Location $MyPath/vite; npm run verify:ci Set-Location $MyPath/webpack; npm run verify:ci Set-Location $MyPath/angular; npm run verify:ci Set-Location $MyPath/pnpm; pnpm run verify:ci -# Set-Location $MyPath/yarn; yarn run verify:ci +Set-Location $MyPath/yarn; yarn run verify:ci diff --git a/verify/buildAll.sh b/verify/buildAll.sh index 8d444e399..a50d7a637 100644 --- a/verify/buildAll.sh +++ b/verify/buildAll.sh @@ -4,4 +4,4 @@ cd $MyPath/vite; npm run verify:ci cd $MyPath/webpack; npm run verify:ci cd $MyPath/angular; npm run verify:ci cd $MyPath/pnpm; pnpm run verify:ci -# cd $MyPath/yarn; yarn run verify:ci +cd $MyPath/yarn; yarn run verify:ci diff --git a/verify/pnpm/src/client/main.ts b/verify/pnpm/src/client/main.ts index f7fc41613..04cec2307 100644 --- a/verify/pnpm/src/client/main.ts +++ b/verify/pnpm/src/client/main.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { configureMonacoWorkers, runJsonWrapper } from 'monaco-languageclient-examples/json-client'; diff --git a/verify/vite/src/client/main.ts b/verify/vite/src/client/main.ts index f7fc41613..04cec2307 100644 --- a/verify/vite/src/client/main.ts +++ b/verify/vite/src/client/main.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { configureMonacoWorkers, runJsonWrapper } from 'monaco-languageclient-examples/json-client'; diff --git a/verify/webpack/src/client/main.ts b/verify/webpack/src/client/main.ts index f7fc41613..04cec2307 100644 --- a/verify/webpack/src/client/main.ts +++ b/verify/webpack/src/client/main.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { configureMonacoWorkers, runJsonWrapper } from 'monaco-languageclient-examples/json-client'; diff --git a/verify/webpack/webpack.config.js b/verify/webpack/webpack.config.js index 1e9e270ac..5c5f40638 100644 --- a/verify/webpack/webpack.config.js +++ b/verify/webpack/webpack.config.js @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ // solve: __dirname is not defined in ES module scope diff --git a/verify/yarn/src/client/main.ts b/verify/yarn/src/client/main.ts index f7fc41613..04cec2307 100644 --- a/verify/yarn/src/client/main.ts +++ b/verify/yarn/src/client/main.ts @@ -1,6 +1,6 @@ /* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox GmbH (http://www.typefox.io). All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { configureMonacoWorkers, runJsonWrapper } from 'monaco-languageclient-examples/json-client'; diff --git a/vite.config.ts b/vite.config.ts index ed07a5ed4..62cf48ef8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -34,7 +34,7 @@ export default defineConfig(() => { }, resolve: { // not needed here, see https://github.com/TypeFox/monaco-languageclient#vite-dev-server-troubleshooting - // dedupe: ['monaco-editor', 'vscode'] + // dedupe: ['vscode'] }, server: { origin: 'http://localhost:20001',