Skip to content

Commit 3b1b25c

Browse files
authored
Merge pull request #863 from TypeFox/mva-next
Update to monaco-vscode-api 14.0.4 and incremented versions to x.4.0.
2 parents a710e3f + 835f725 commit 3b1b25c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2302
-1824
lines changed

README.md

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,15 @@ The examples not requiring a backend are now available [via GitHub Pages](https:
4545
- [Server processes](#server-processes)
4646
- [JSON Language Server](#json-language-server)
4747
- [Pyright Language Server](#pyright-language-server)
48+
- [Graalpy Debugger](#graalpy-debugger)
4849
- [Groovy Language Server](#groovy-language-server)
4950
- [Java Language Server](#java-language-server)
5051
- [Verification Examples \& Usage](#verification-examples--usage)
5152
- [VSCode integration](#vscode-integration)
5253
- [Featured projects](#featured-projects)
5354
- [Troubleshooting](#troubleshooting)
5455
- [General](#general)
56+
- [@codingame/monaco-vscode-editor-api / monaco-editor usage](#codingamemonaco-vscode-editor-api--monaco-editor-usage)
5557
- [Dependency issues: monaco-editor / @codingame/monaco-vscode-api / @codingame/monaco-vscode-editor-api](#dependency-issues-monaco-editor--codingamemonaco-vscode-api--codingamemonaco-vscode-editor-api)
5658
- [Volta](#volta)
5759
- [Vite dev server troubleshooting](#vite-dev-server-troubleshooting)
@@ -60,7 +62,6 @@ The examples not requiring a backend are now available [via GitHub Pages](https:
6062
- [Bad Polyfills](#bad-polyfills)
6163
- [buffer](#buffer)
6264
- [monaco-editor and react](#monaco-editor-and-react)
63-
- [pnpm](#pnpm)
6465
- [Licenses](#licenses)
6566

6667
## Changelogs, project history and compatibility
@@ -137,7 +138,7 @@ The **json-client** contains the [monaco-editor-wrapper app](./packages/examples
137138

138139
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)).
139140
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.
140-
It is also possible to use a [@typefox/monaco-editor-react app](./packages/examples/src/python/client/reactPython.tsx) to connect to the server.
141+
It is also possible to use a [@typefox/monaco-editor-react app](./packages/examples/src/python/client/reactPython.tsx) to connect to the server. Both versions now feature a debugger, see [here](#graalpy-debugger).
141142

142143
#### Groovy Language client and language server example ([Location](./packages/examples/src/groovy))
143144

@@ -200,6 +201,10 @@ For the **python-client** example you need to ensure the **python-server** examp
200201
npm run start:example:server:python
201202
```
202203

204+
##### Graalpy Debugger
205+
206+
If you want to use the debugger in the **python-client** example you need to the debugger is running. You require **docker-compose** to run it. From the project root run `docker-compose -f ./packages/examples/resources/debugger/docker-compose.yml up -d`. First start up will take longer as the container is downloaded from GitHub's container registry. Use `docker-compose -f ./packages/examples/resources/debugger/docker-compose.yml down` to stop it.
207+
203208
##### Groovy Language Server
204209

205210
For the **groovy-client** example you need to ensure the **groovy-server** example is running. You require **docker-compose** which does not require any manual setup (OpenJDK / 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 downloaded from GitHub's container registry. Use `docker-compose -f ./packages/examples/resources/groovy/docker-compose.yml down` to stop it.
@@ -214,15 +219,11 @@ None of the verification examples is part of the npm workspace. Some bring subst
214219

215220
- [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: <http://localhost:4200>.
216221

217-
- [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: <http://localhost:8081>.
218-
219-
- [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: <http://localhost:8082>.
220-
221-
- [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: <http://localhost:8083>.
222+
- [Next.js verification example](./verify/next): demonstrates how to use `@typefox/monaco-editor-react` with Next.js, Please do: `cd verify/next && npm run verify`. It serves the client here: <http://localhost:8081>.
222223

223-
- [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: <http://localhost:8083>.
224+
- [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: <http://localhost:8082>.
224225

225-
- [Next.js verification example](./verify/next): demonstrates how to use `@typefox/monaco-editor-react` with Next.js, Please do: `cd verify/next && npm run verify`. It serves the client here: <http://localhost:8084>.
226+
- [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: <http://localhost:8083>.
226227

227228
### VSCode integration
228229

@@ -238,11 +239,38 @@ You can as well run [vscode tasks](./.vscode/launch.json) to start and debug the
238239

239240
### General
240241

241-
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.
242+
Whenever you used `monaco-editor`/`@codingame/monaco-vscode-editor-api` `vscode`/`@codingame/monaco-vscode-extension-api`, `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.
243+
244+
If you use pnpm or yarn, you have to add `vscode` / `@codingame/monaco-vscode-api` as direct dependency, otherwise the installation will fail:
245+
246+
```json
247+
"vscode": "npm:@codingame/monaco-vscode-extension-api@~14.0.4"
248+
```
249+
250+
### @codingame/monaco-vscode-editor-api / monaco-editor usage
251+
252+
When you use the libraries from this project you are no longer are required to proxy `monaco-editor` like `"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~14.0.4"` in you `package.json`. You can directly use it like this:
253+
254+
```js
255+
import * as monaco from '@codingame/monaco-vscode-editor-api';
256+
```
257+
258+
If your dependency stack already contains a reference `monaco-editor` you must enforce the correct reference to `@codingame/monaco-vscode-editor-api` or you will have problems with mismatching code. Use`overrides` (npm/pnpm) or `resolutions` (yarn) to do so:
259+
260+
```json
261+
"overrides": {
262+
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~14.0.4"
263+
}
264+
```
242265

243266
### Dependency issues: monaco-editor / @codingame/monaco-vscode-api / @codingame/monaco-vscode-editor-api
244267

245-
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.
268+
If you have mutiple, possibly hundreds of compile errors resulting from missing functions deep in `monaco-editor` or `vscode` then it is very likely you have a mismatching dependency definition somewhere in your dependency definitions:
269+
270+
1. Use `npm list @codingame/monaco-vscode-api` to see if there are two different versions are listed in the dependency tree.
271+
2. If you see a message in the browser console starting with `Another version of monaco-vscode-api has already been loaded. Trying to load` then definetly a version mismatch was detected by `@codingame/monaco-vscode-api`. This error is reported since v14.
272+
273+
If one of the two is true, fix you dependencies, remove `package-lock.json` and `node_modules` and perform a fresh `npm install`.
246274

247275
### Volta
248276

@@ -252,7 +280,7 @@ There are [Volta](https://volta.sh/) instructions in the `package.json` files. W
252280

253281
When you are using the vite dev server there are some issues with imports, please [read this recommendation](https://github.com/CodinGame/monaco-vscode-api/wiki/Troubleshooting#if-you-use-vite).
254282

255-
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:
283+
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-extension-api`. You should fix this or add the following entry to your vite config:
256284

257285
```javascript
258286
resolve: {
@@ -262,7 +290,7 @@ resolve: {
262290

263291
### SSR frameworks
264292

265-
**Important:** Due to its reliance on `monaco-editor` and `@codingame/monaco-vscode-api` this stack will very likely not work with Server-Side Rendering (SSR) frameworks. They client code has to be run in a browser environment.
293+
**Important:** Due to its reliance on `@codingame/monaco-vscode-api` this stack will not directly work with Server-Side Rendering (SSR) frameworks like Next.js. They client code has to be run in a browser environment. Take a look at the [Next.js verification example](./verify/next) to see how to dynamically load the code.
266294

267295
### Serve all files required
268296

@@ -302,22 +330,6 @@ import { loader } from "@monaco-editor/react";
302330
loader.config({ monaco });
303331
```
304332

305-
Because `@codingame/monaco-vscode-api` relies on it own build of `monaco-editor` it may be required to enforce the `monaco-editor` version via `overrides` (npm/pnpm) or `resolutions` (yarn):
306-
307-
```json
308-
"overrides": {
309-
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~14.0.2"
310-
}
311-
```
312-
313-
### pnpm
314-
315-
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.
316-
317-
```json
318-
"vscode": "npm:@codingame/monaco-vscode-extension-api@~14.0.2"
319-
```
320-
321333
## Licenses
322334

323335
- monaco-languageclient: [MIT](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/client/LICENSE)

docs/versions-and-history.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The following table describes which version of **monaco-languageclient** and **@
66

77
| monaco-languageclient | monaco-editor-wrapper | monaco-editor-react | monaco-vscode-api / editor-api | vscode | monaco-editor | release date | comment |
88
| :---- | :---- | :--- | :--- | :--- | :--- | :--- | :--- |
9+
| 9.4.0 | 6.4.0 | 6.4.0 | 14.0.4 | 1.97.2 | 0.52.2 | 2025-02-18 | |
910
| 9.3.0 | 6.3.0 | 6.3.0 | 14.0.2 | 1.97.0 | 0.52.2 | 2025-02-12 | |
1011
| 9.2.5 | 6.2.5 | 6.2.5 | 13.1.6 | 1.96.4 | 0.52.2 | 2025-02-08 | |
1112
| 9.2.4 | 6.2.4 | 6.2.4 | 13.1.4 | 1.96.4 | 0.52.2 | 2025-02-06 | |

index.html

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,15 @@ <h3>Angular</h2>
102102
Please start <b><code>cd verify/angular && npm run verify</code></b> beforehand:<br>
103103
<a href="http://localhost:4200">JSON Language Client & Language Server (Web Socket) (Angular Dev Server)</a>
104104
<h3>Next.js</h3>
105-
Please start <b><code>cd verify/next && npm run verify</code></b> beforehand:<br>
106-
<a href="http://localhost:8084">JSON Language Client & Language Server (Web Socket) (Next.js Dev Server)</a>
105+
Please start <b><code>cd verify/next && npm run verify</code></b> beforehand:<br>
106+
<a href="http://localhost:8081">JSON Language Client & Language Server (Web Socket) (Next.js Dev Server)</a>
107107
<h3>Webpack</h3>
108-
Please start <b><code>cd verify/webpack && npm run verify</code></b> beforehand:<br>
109-
<a href="http://localhost:8081">JSON Language Client & Language Server (Web Socket) (webpack build)</a>
108+
Please start <b><code>cd verify/webpack && npm run verify</code></b> beforehand:<br>
109+
<a href="http://localhost:8082">JSON Language Client & Language Server (Web Socket) (webpack build)</a>
110110
<h3>Vite</h3>
111-
Please start <b><code>cd verify/vite && npm run verify</code></b> beforehand:<br>
112-
<a href="http://localhost:8082">JSON Language Client & Language Server (Web Socket) (vite build)</a>
113-
<h3>Pnpm/vite</h3>
114-
Please start <b><code>cd verify/pnpm && pnpm run verify</code></b> beforehand:<br>
115-
<a href="http://localhost:8083">JSON Language Client & Language Server (Web Socket) (pnpm/vite build)</a>
116-
<h3>Yarn/vite</h3>
117-
Please start <b><code>cd verify/yarn && yarn run verify</code></b> beforehand:<br>
118-
<a href="http://localhost:8083">JSON Language Client & Language Server (Web Socket) (yarn/vite build)</a>
119-
</div>
111+
Please start <b><code>cd verify/vite && npm run verify</code></b> beforehand:<br>
112+
<a href="http://localhost:8083">JSON Language Client & Language Server (Web Socket) (vite build)</a>
113+
</div>
120114
</body>
121115

122116
</html>

0 commit comments

Comments
 (0)