@codingame/monaco-vscode-api 1.67.7 → 1.67.8

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
@@ -1,8 +1,17 @@
1
1
  # @codingame/monaco-vscode-api · [![monthly downloads](https://img.shields.io/npm/dm/@codingame/monaco-vscode-api)](https://www.npmjs.com/package/@codingame/monaco-vscode-api) [![npm version](https://img.shields.io/npm/v/@codingame/monaco-vscode-api.svg?style=flat)](https://www.npmjs.com/package/@codingame/monaco-vscode-api) [![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/codingame/monaco-vscode-api/pulls)
2
2
 
3
- [NPM module](https://www.npmjs.com/) that respects the vscode api and redirect calls to monaco editor.
3
+ [NPM module](https://www.npmjs.com/) that implements the VSCode api and redirects calls to Monaco editor.
4
4
 
5
- Some features not supported by monaco (type hierarchy, call hierarchy...) can be implemented by hands:
5
+ The VSCode api is composed of:
6
+
7
+ - A lot of classes and tools, which are exported the same way as in VSCode.
8
+ - Some features that are supported by Monaco (Language feature registrations...) which are just forwarded to it (with some transformations)
9
+ - Some features that are not supported by Monaco, and in such case:
10
+ - If it's an important feature: we let the user implement it as they wish.
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
+
13
+
14
+ To implement by hands the optional features (type hierarchy, call hierarchy...), you can use the `Services` namespace from `vscode/services`:
6
15
  ```typescript
7
16
  import { Services } from 'vscode/services'
8
17
  Services.install({
@@ -25,7 +34,7 @@ npm install -D @types/vscode
25
34
 
26
35
  ### Usage
27
36
 
28
- Just import it as if you were in a vscode extensions:
37
+ Just import it as if you were in a vscode extension:
29
38
 
30
39
  ```typescript
31
40
  import * as vscode from 'vscode'
@@ -33,4 +42,3 @@ import * as vscode from 'vscode'
33
42
  const range = new new vscode.Range(...)
34
43
  vscode.languages.registerCompletionItemProvider(...)
35
44
  ```
36
-
package/dist/api.amd.js CHANGED
@@ -7478,11 +7478,7 @@ define(['exports', 'monaco-editor/esm/vs/base/common/errors.js', 'monaco-editor/
7478
7478
  return data.document;
7479
7479
  }
7480
7480
  getDocumentData(resource) {
7481
- const model = monaco__namespace.editor.getModel(monaco__namespace.Uri.from(resource));
7482
- if (model == null) {
7483
- throw new Error(`Unable to retrieve document from URI '${resource}'`);
7484
- }
7485
- return createDocumentDataFromModel(model);
7481
+ return this.documentsData.get(resource.toString());
7486
7482
  }
7487
7483
  get onDidAddDocument() { return this._onDidAddDocument.event; }
7488
7484
  get onDidRemoveDocument() { return this._onDidRemoveDocument.event; }
package/dist/api.cjs CHANGED
@@ -7520,11 +7520,7 @@ class MonacoExtHostDocuments {
7520
7520
  return data.document;
7521
7521
  }
7522
7522
  getDocumentData(resource) {
7523
- const model = monaco__namespace.editor.getModel(monaco__namespace.Uri.from(resource));
7524
- if (model == null) {
7525
- throw new Error(`Unable to retrieve document from URI '${resource}'`);
7526
- }
7527
- return createDocumentDataFromModel(model);
7523
+ return this.documentsData.get(resource.toString());
7528
7524
  }
7529
7525
  get onDidAddDocument() { return this._onDidAddDocument.event; }
7530
7526
  get onDidRemoveDocument() { return this._onDidRemoveDocument.event; }
package/dist/api.js CHANGED
@@ -7493,11 +7493,7 @@ class MonacoExtHostDocuments {
7493
7493
  return data.document;
7494
7494
  }
7495
7495
  getDocumentData(resource) {
7496
- const model = monaco.editor.getModel(monaco.Uri.from(resource));
7497
- if (model == null) {
7498
- throw new Error(`Unable to retrieve document from URI '${resource}'`);
7499
- }
7500
- return createDocumentDataFromModel(model);
7496
+ return this.documentsData.get(resource.toString());
7501
7497
  }
7502
7498
  get onDidAddDocument() { return this._onDidAddDocument.event; }
7503
7499
  get onDidRemoveDocument() { return this._onDidRemoveDocument.event; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-api",
3
- "version": "1.67.7",
3
+ "version": "1.67.8",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor",
6
6
  "keywords": [],