Skip to content

Commit 916e77d

Browse files
authored
Merge pull request #902 from TypeFox/dep-update
Dependency updates
2 parents b83ab09 + 12da186 commit 916e77d

31 files changed

+2000
-2706
lines changed

README.md

+60-4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ The examples not requiring a backend are now available [via GitHub Pages](https:
6262
- [Bad Polyfills](#bad-polyfills)
6363
- [buffer](#buffer)
6464
- [monaco-editor and react](#monaco-editor-and-react)
65+
- [webpack worker issues](#webpack-worker-issues)
6566
- [Licenses](#licenses)
6667

6768
## Changelogs, project history and compatibility
@@ -76,7 +77,18 @@ CHANGELOGs for each project are available from the linked location:
7677

7778
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).
7879

79-
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).
80+
These are the current versions of packages from this repository and their alignment with **@codingame/monaco-vscode-api** **monaco-editor** and **vscode**:
81+
82+
- **monaco-languageclient**: `9.6.0-next.0` (release date: 2025-04-0x)
83+
- **monaco-editor-wrapper**: `6.7.0-next.0` (release date: 2025-04-0x)
84+
- **@typefox/monaco-editor-react**: `6.7.0-next.0` (release date: 2025-04-0x)
85+
- Aligned with:
86+
- **@codingame/monaco-vscode-[editor]-api**: `15.0.3`
87+
- **vscode**: `1.98.2`
88+
- **monaco-editor**: `0.52.2`
89+
- **vscode-ws-jsonrpc**: `3.4.0` (release date: 2024-12-18)
90+
91+
You find the full compatibility table with all previous versions [here](https://github.com/TypeFox/monaco-languageclient/blob/main/docs/versions-and-history.md#monaco-editor--codingamemonaco-vscode-api-compatibility-table).
8092

8193
[This article](https://www.typefox.io/blog/teaching-the-language-server-protocol-to-microsofts-monaco-editor/) describes the initial motivation for starting monaco-languageclient.
8294

@@ -244,12 +256,12 @@ Whenever you used `monaco-editor`/`@codingame/monaco-vscode-editor-api` `vscode`
244256
If you use pnpm or yarn, you have to add `vscode` / `@codingame/monaco-vscode-api` as direct dependency, otherwise the installation will fail:
245257

246258
```json
247-
"vscode": "npm:@codingame/monaco-vscode-extension-api@~15.0.2"
259+
"vscode": "npm:@codingame/monaco-vscode-extension-api@~15.0.3"
248260
```
249261

250262
### @codingame/monaco-vscode-editor-api / monaco-editor usage
251263

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@~15.0.2"` in you `package.json`. You can directly use it like this:
264+
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@~15.0.3"` in you `package.json`. You can directly use it like this:
253265

254266
```js
255267
import * as monaco from '@codingame/monaco-vscode-editor-api';
@@ -259,7 +271,7 @@ If your dependency stack already contains a reference `monaco-editor` you must e
259271

260272
```json
261273
"overrides": {
262-
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~15.0.2"
274+
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~15.0.3"
263275
}
264276
```
265277

@@ -330,6 +342,50 @@ import { loader } from "@monaco-editor/react";
330342
loader.config({ monaco });
331343
```
332344

345+
### webpack worker issues
346+
347+
When webpack is used as bundler there are issues with utilizing the undbundled workers from `@codingame/monaco-vscode-api`. [jhk-mjolner](https://github.com/jhk-mjolner) provided a solution in the context of issue #853 [here](https://github.com/TypeFox/monaco-languageclient/issues/853#issuecomment-2709959822):
348+
349+
1. Npm install `webpack-cli` (or webpack will do it for you when you try running this later).
350+
2. Create a `bundle-monaco-workers.js` file with this content:
351+
352+
```js
353+
// solve: __dirname is not defined in ES module scope
354+
import { fileURLToPath } from 'url';
355+
import { dirname, resolve } from 'path';
356+
357+
const __filename = fileURLToPath(import.meta.url);
358+
const __dirname = dirname(__filename);
359+
360+
export default {
361+
entry: {
362+
editor: './node_modules/@codingame/monaco-vscode-editor-api/esm/vs/editor/editor.worker.js',
363+
textmate: './node_modules/@codingame/monaco-vscode-textmate-service-override/worker.js'
364+
},
365+
output: {
366+
filename: '[name].js',
367+
path: resolve(__dirname, './src/assets/monaco-workers'),
368+
// if this is true (default), webpack will produce code trying to access global `document` variable for the textmate worker, which will fail at runtime due to being a worker
369+
chunkLoading: false
370+
},
371+
mode: 'production',
372+
performance: {
373+
hints: false
374+
}
375+
};
376+
```
377+
378+
3. Add this line to your `packages.json` scripts section: `"bundle monaco workers": "webpack --config bundle-monaco-workers.js"`
379+
4. Run the script `npm run 'bundle monaco workers'`
380+
5. Configure the `workerLoaders` parameter for `useWorkerFactory` to point to the pre-bundled workers:
381+
382+
```js
383+
'TextEditorWorker': () => new Worker('/assets/monaco-workers/editor.js', {type: 'module'}),
384+
'TextMateWorker': () => new Worker('/assets/monaco-workers/textmate.js', {type: 'module'}),
385+
```
386+
387+
6. Enable `editor.experimental.asyncTokenization` in the monaco-wrapper config, if you want to use the textmate worker.
388+
333389
## Licenses
334390

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

docs/versions-and-history.md

+1
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.6.0-next.0 | 6.7.0-next.0 | 6.7.0-next.0 | 15.0.3 | 1.98.2 | 0.52.2 | 2025-04-0x | |
910
| 9.5.0 | 6.6.0 | 6.6.0 | 15.0.2 | 1.97.2 | 0.52.2 | 2025-03-13 | |
1011
| 9.4.0 | 6.4.0 | 6.4.0 | 14.0.4 | 1.97.2 | 0.52.2 | 2025-02-18 | |
1112
| 9.3.0 | 6.3.0 | 6.3.0 | 14.0.2 | 1.97.0 | 0.52.2 | 2025-02-12 | |

0 commit comments

Comments
 (0)