Skip to content

Commit

Permalink
doc: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Mangeonjean committed Apr 28, 2023
1 parent b83ba0a commit cffb4d0
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,32 @@ The VSCode api is composed of:
- If it's an important feature: it requires to use the corresponding service override.
- If it's some advanced features that don't make a lot of sense on Monaco (scm, tests...), it just throws an error when you try to use it.

## Installation

```bash
npm install vscode@npm:@codingame/monaco-vscode-api
npm install -D @types/vscode
```

⚠️ And add in your package.json ⚠️:
```json
{
"scripts": {
"postinstall": "monaco-treemending",
}
}
```

### Why?

Monaco-editor is a library that is constructed using code from vscode and goes through an intense treeshaking process.

However, due to the inclusion of additional code from VSCode in this library that utilizes internal modules bundled in monaco, this treeshaking is a problem here.

To **tree-mend** (to **un**treeshake it) monaco-editor, this library provide a script that will apply a patch on the local installation of monaco-editor, restoring all the code that was treeshaken during the monaco-editor build process

# Usage

## Monaco standalone services

Also, monaco-editor use `standalone` versions or the vscode services, which are much simpler.
Expand All @@ -30,7 +56,7 @@ await initialize({
})
```

Additionally, this library exposes 11 modules that include the vscode version of some services (with some glue to make it work with monaco):
Additionally, this library exposes 13 modules that include the vscode version of some services (with some glue to make it work with monaco):

- Notifications: `vscode/service-override/notifications`
- Dialogs: `vscode/service-override/dialogs`
Expand Down Expand Up @@ -120,14 +146,7 @@ The only difference is that is will use the `configurationService` as a default
`createModelReference` return a reference to a model. The value is fetched from the memory filesystem (which is written if you provide the second argument).
The reference can then be disposed, the model will only be disposed if there is no remaining references.

### Installation

```bash
npm install vscode@npm:@codingame/monaco-vscode-api
npm install -D @types/vscode
```

### Usage
## VSCode api usage

You can just import it as if you were in a vscode extension:

Expand Down

0 comments on commit cffb4d0

Please sign in to comment.