@codingame/monaco-vscode-api 1.69.22 → 1.69.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,8 +10,8 @@ The VSCode api is composed of:
10
10
  - If it's an important feature: we let the user implement it as they wish.
11
11
  - If it's some advanced features that don't make a lot of sense on Monaco (debug, tests...), it just throws an error when you try to use it.
12
12
 
13
-
14
13
  To implement by hands the optional features (file system, workspace folders, file...), you can use the `Services` namespace from `vscode/services`:
14
+
15
15
  ```typescript
16
16
  import { Services } from 'vscode/services'
17
17
  Services.install({
@@ -37,6 +37,7 @@ This library allows you to use a more convenient way using `StandaloneServices.i
37
37
  Also, monaco-editor doesn't provide good type for them, so this library does it.
38
38
 
39
39
  Example:
40
+
40
41
  ```typescript
41
42
  import { StandaloneServices, INotificationService } from 'vscode/services'
42
43
 
@@ -49,6 +50,7 @@ StandaloneServices.initialize({
49
50
  ```
50
51
 
51
52
  Additionally, this library exposes 10 modules that include the vscode version of some services (with some glue to make it work with monaco):
53
+
52
54
  - Notifications: `vscode/service-override/notifications`
53
55
  - Dialogs: `vscode/service-override/dialogs`
54
56
  - Model / Editor: `vscode/service-override/modelEditor`
@@ -62,6 +64,7 @@ Additionally, this library exposes 10 modules that include the vscode version of
62
64
  - Token classification: `vscode/service-override/tokenClassification`
63
65
 
64
66
  Usage:
67
+
65
68
  ```typescript
66
69
  import { StandaloneServices } from 'vscode/services'
67
70
  import getModelEditorServiceOverride from 'vscode/service-override/modelEditor'
@@ -106,12 +109,14 @@ The editors created using `monaco.editor.create` don't use the configuration fro
106
109
  This library exposes functions to create editors binded on the configuration:
107
110
 
108
111
  before:
112
+
109
113
  ```typescript
110
114
  import * as monaco from 'monaco-editor'
111
115
  monaco.editor.create(...)
112
116
  ```
113
117
 
114
118
  after:
119
+
115
120
  ```typescript
116
121
  import { createConfiguredEditor } from 'vscode/monaco'
117
122
 
@@ -143,6 +148,7 @@ vscode.languages.registerCompletionItemProvider(...)
143
148
 
144
149
  There is a demo that showcases the service-override features. It allows to register contributions with the same syntaxes as in VSCode.
145
150
  It includes:
151
+
146
152
  - Languages
147
153
  - Language configurations
148
154
  - VSCode themes
@@ -157,10 +163,13 @@ It includes:
157
163
  It also uses the `getJsonSchemas` function to register them on the monaco json worker and have autocomplete/hover on settings and keybindings.
158
164
 
159
165
  From CLI run:
166
+
160
167
  ```bash
161
168
  cd demo
162
169
  npm ci
163
- npm start
170
+ npm run start
171
+ # OR: for vite debug output
172
+ npm run start:debug
164
173
  ```
165
174
 
166
175
  ### History
@@ -170,17 +179,20 @@ This project was mainly created to make the implementation of [monaco-languagecl
170
179
  monaco-languageclient uses [vscode-languageclient](https://www.npmjs.com/package/vscode-languageclient) which was built to run inside a VSCode extension. VSCode extensions communicate with the editor via an [API](https://www.npmjs.com/package/@types/vscode) they can import into their code.
171
180
 
172
181
  [The VSCode api](https://code.visualstudio.com/api/references/vscode-api) exports:
182
+
173
183
  - Some functions to interact with the IDE ([language feature registrations](https://code.visualstudio.com/api/references/vscode-api#languages), [command execution](https://code.visualstudio.com/api/references/vscode-api#commands)...)
174
184
  - A lot of utility classes (Range, Position...)
175
185
 
176
186
  The first implementations of [monaco-languageclient](https://github.com/TypeFox/monaco-languageclient) were using a fake VSCode api implementation. The vscode-languageclient was hacked so the VSCode<->protocol object converters were mainly bypassed, so the fake VSCode api was receiving [Language Server Protocol](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/) objects. Then the objects were transformed using custom transformers into [Monaco](https://www.npmjs.com/package/monaco-editor) objects to communicate with the monaco api.
177
187
 
178
188
  This approach has some disadvantages:
189
+
179
190
  - There is a lot of code to transform LSP objects into Monaco objects
180
191
  - It's hard to follow the updates of VSCode and the language server protocol
181
192
  - It doesn't behave exactly the same as in VSCode
182
193
 
183
194
  With this library, it would be possible to plug vscode-languageclient directly on top of monaco, monaco-languageclient still helps to do so by:
195
+
184
196
  - Adding some tweaks to the VSCode LanguageClient (Removing unsupported features...)
185
197
  - Providing a default implementations of the required fallback services (`vscode/services`)
186
198
  - Providing some examples on how to build an app using it
package/dist/tools.js CHANGED
@@ -5,7 +5,7 @@ import { Extensions } from 'monaco-editor/esm/vs/platform/jsonschemas/common/jso
5
5
  import Severity from 'monaco-editor/esm/vs/base/common/severity.js';
6
6
  import { onUnexpectedError } from 'monaco-editor/esm/vs/base/common/errors.js';
7
7
  import { ExtensionIdentifier } from 'monaco-editor/esm/vs/platform/extensions/common/extensions.js';
8
- import { EventEmitter } from 'vscode';
8
+ import { E as Emitter } from './workspace.js';
9
9
  import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
10
10
  const EXTENSION_CATEGORIES = [
11
11
  'Azure',
@@ -835,7 +835,7 @@ function consoleExtensionMessageHandler(msg) {
835
835
  function getExtensionPoint(extensionPoint) {
836
836
  return ExtensionsRegistry.getExtensionPoints().find(ep => ep.name === extensionPoint);
837
837
  }
838
- const emitter = new EventEmitter();
838
+ const emitter = new Emitter();
839
839
  const onServicesInitialized = emitter.event;
840
840
  let initialized = false;
841
841
  const original = StandaloneServices.initialize;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-api",
3
- "version": "1.69.22",
3
+ "version": "1.69.24",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor",
6
6
  "keywords": [],
@@ -135,11 +135,12 @@
135
135
  "README.md"
136
136
  ],
137
137
  "scripts": {
138
- "build": "rm -rf dist/ && npm run lint && npm run compile && npm run generate-types && npm run compile-webpack-loader",
138
+ "build": "npm run clean && npm run compile && npm run lint && npm run generate-types && npm run compile-webpack-loader",
139
139
  "compile": "rollup --config rollup/rollup.config.ts --configPlugin 'typescript={tsconfig: `tsconfig.rollup.json`}' --vscode-version ${npm_package_config_vscode_version}",
140
+ "clean": "rm -rf dist/",
140
141
  "compile-webpack-loader": "tsc --target es2020 -lib es2020 --module commonjs --skipLibCheck --moduleResolution node --declaration --outDir dist src/webpack-loader.ts && mv dist/webpack-loader.js dist/webpack-loader.cjs",
141
142
  "preprepare": "./scripts/install-vscode",
142
- "lint": "eslint --ext ts src",
143
+ "lint": "eslint {**/src/**/*.ts,./rollup/*.ts,./*.ts}",
143
144
  "generate-types": "tsc --project tsconfig.types.json && rollup --config rollup/rollup.types.config.ts --configPlugin 'typescript={tsconfig: `tsconfig.rollup.json`}' && rm -rf ./dist/types",
144
145
  "release": "node --loader ts-node/esm release.ts ${npm_package_config_vscode_version}"
145
146
  },
@@ -195,7 +196,7 @@
195
196
  }
196
197
  },
197
198
  "volta": {
198
- "node": "18.13.0",
199
- "npm": "9.4.1"
199
+ "node": "18.14.2",
200
+ "npm": "9.5.1"
200
201
  }
201
202
  }