Skip to content

Commit

Permalink
WIP: Updated to @codingame/moanco-vscode-api v2
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisalmen committed Jan 26, 2024
1 parent 8396389 commit 2482e28
Show file tree
Hide file tree
Showing 22 changed files with 449 additions and 549 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ npm run watch

## Using monaco-languageclient

TODO: Section needs to be overhauled

### NEW with v7: Treemended monaco-editor

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`.
Expand All @@ -85,16 +87,14 @@ Earlier in 2023 we started to treemend an existing `monaco-editor` dependency vi

#### Overrides instructions

With v7 we decided to use readily treemended version of monaco-editor called [@codingame/monaco-editor-treemended](https://www.npmjs.com/package/@codingame/monaco-editor-treemended), but this requires to add `overrides` (npm/pnpm) and `resolutions` (yarn) in your project. Setting these ensures that all dependencies to `monaco-editor` and `vscode` are aligned:
With v7 we decided to use readily treemended version of monaco-editor called [@codingame/monaco-vscode-editor-api](https://www.npmjs.com/package/@codingame/monaco-vscode-editor-api), but this requires to add `overrides` (npm/pnpm) and `resolutions` (yarn) in your project. Setting these ensures that all dependencies to `monaco-editor` and `vscode` are aligned:

```yaml
"overrides": {
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.85.5 <1.86.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.85.5 <1.86.0"
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@>=2.0.0-rework-ci.1 <2.1.0"
},
"resolutions": {
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.85.5 <1.86.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.85.5 <1.86.0"
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@>=2.0.0-rework-ci.1 <2.1.0"
}
```

Expand Down Expand Up @@ -246,6 +246,8 @@ Ensure **monaco-editor**, **vscode** and **monaco-languageclient** are imported

### Dependency issues: monaco-editor / @codingame/monaco-editor-treemended

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.

Expand Down Expand Up @@ -334,7 +336,7 @@ loader.config({ monaco });
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.

```json
"vscode": "npm:@codingame/monaco-vscode-api@>=1.85.5 <1.86.0"
"vscode": "npm:@codingame/monaco-vscode-api@>=2.0.0-rework-ci.1 <2.1.0"
```

## Monaco-editor / @codingame/monaco-vscode-api compatibility table
Expand Down
8 changes: 6 additions & 2 deletions docs/versions-and-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

The following table describes which version of **monaco-languageclient** and **@codingame/monaco-vscode-api** are compatible with a specific version of **monaco-editor**. The listing starts with version 2.0.0 because **@codingame/monaco-vscode-api** was introduced for the first time.

| monaco-languageclient | monaco-vscode-api | monaco-editor-treemended | monaco-editor | release date | comment |
| monaco-languageclient | monaco-vscode-api | monaco-vscode-editor-api | monaco-editor | release date | comment |
| :---- | :---- | :--- | :--- | :--- | :--- |
| 7.4.0 | 1.85.5 | 1.85.5 | 0.45.0 | 2024-01-2x | |
| 8.0.0 | 2.0.0 | 2.0.0 | 0.45.0 | 2024-02-0x | `@codingame/monaco-vscode-editor-api` replaces `@codingame/monaco-editor-treemended` |
| 7.3.0 | 1.85.0 | 1.85.0 | 0.45.0 | 2024-01-04 | |
| 7.2.0 | 1.83.16 | 1.83.16 | 0.44.0 | 2023-12-07 | |
| 7.1.0 | 1.83.12 | 1.83.12 | 0.44.0 | 2023-11-27 | |
Expand Down Expand Up @@ -45,6 +45,10 @@ The following table describes which version of **monaco-languageclient** and **@

## Important Project Changes

### Febuary 2024 (v8.0.0)

`@codingame/monaco-editor-treemended` is replaced by self-standing `@codingame/monaco-vscode-editor-api`.

### October 2023 (v7.0.0)

Revised the `treemending` approach. The postinstall step is removed. `monaco-languageclient` no longer patches and existing `monaco-editor` instead the package `@codingame/monaco-editor-treemended` is used. This requires that projects using this lib have to enforce the correct editor by overrides (npm/pnpm) or resolutions (yarn) in the `package.json`.
Expand Down
Loading

0 comments on commit 2482e28

Please sign in to comment.