@codingame/monaco-vscode-api 3.1.0 → 3.1.2

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
@@ -405,7 +405,7 @@ This library also offers the possibility to localize vscode and the extensions i
405
405
 
406
406
  ### Demo
407
407
 
408
- Try it out on https://codingame.github.io/monaco-vscode-api/
408
+ Try it out on https://monaco-vscode-api.netlify.app/
409
409
 
410
410
  There is a demo that showcases the service-override features. It allows to register contributions with the same syntaxes as in VSCode.
411
411
  It includes:
package/api.js CHANGED
@@ -29,7 +29,7 @@ function createProxy(key) {
29
29
  });
30
30
  }
31
31
  const api = {
32
- version: "1.87.1",
32
+ version: "1.87.2",
33
33
  tasks: createProxy('tasks'),
34
34
  notebooks: createProxy('notebooks'),
35
35
  scm: createProxy('scm'),
package/l10n.js CHANGED
@@ -1,6 +1,9 @@
1
- import { setLocale } from './vscode/src/vs/nls.js';
1
+ import { isInitialized, setLocale } from './vscode/src/vs/nls.js';
2
2
  const extensionTranslationsUri = {};
3
3
  function registerLocalization(language, main, extensionTranslationsUris) {
4
+ if (isInitialized()) {
5
+ console.error('Some parts of VSCode are already initialized, make sure the language pack is loaded before anything else or some translations will be missing');
6
+ }
4
7
  setLocale(language, main);
5
8
  extensionTranslationsUri[language] = extensionTranslationsUris;
6
9
  }
@@ -530,8 +530,8 @@ registerSingleton(IPathService, BrowserPathService, 1 );
530
530
  registerSingleton(IProductService, class ProductService {
531
531
  constructor() {
532
532
  this._serviceBrand = undefined;
533
- this.version = "1.87.1";
534
- this.commit = "1.87.1";
533
+ this.version = "1.87.2";
534
+ this.commit = "1.87.2";
535
535
  this.quality = 'oss';
536
536
  this.nameShort = 'Code - OSS Dev';
537
537
  this.nameLong = 'Code - OSS Dev';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-api",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "VSCode public API plugged on the monaco editor",
5
5
  "keywords": [],
6
6
  "author": {
@@ -96,12 +96,12 @@
96
96
  "dependencies": {
97
97
  "vscode-marked": "npm:marked@=3.0.2",
98
98
  "vscode-semver": "npm:semver@=5.5.0",
99
- "@codingame/monaco-vscode-extensions-service-override": "3.1.0",
100
- "@codingame/monaco-vscode-files-service-override": "3.1.0",
101
- "@codingame/monaco-vscode-quickaccess-service-override": "3.1.0",
102
- "@codingame/monaco-vscode-environment-service-override": "3.1.0",
103
- "@codingame/monaco-vscode-layout-service-override": "3.1.0",
104
- "@codingame/monaco-vscode-host-service-override": "3.1.0",
105
- "@codingame/monaco-vscode-base-service-override": "3.1.0"
99
+ "@codingame/monaco-vscode-files-service-override": "3.1.2",
100
+ "@codingame/monaco-vscode-quickaccess-service-override": "3.1.2",
101
+ "@codingame/monaco-vscode-extensions-service-override": "3.1.2",
102
+ "@codingame/monaco-vscode-environment-service-override": "3.1.2",
103
+ "@codingame/monaco-vscode-layout-service-override": "3.1.2",
104
+ "@codingame/monaco-vscode-host-service-override": "3.1.2",
105
+ "@codingame/monaco-vscode-base-service-override": "3.1.2"
106
106
  }
107
107
  }
package/services.js CHANGED
@@ -150,9 +150,9 @@ async function initialize(overrides, container = document.body, configuration =
150
150
  initialize$1(container, configuration);
151
151
  const instantiationService = StandaloneServices.initialize({
152
152
  [( IProductService.toString())]: mixin({
153
- version: "1.87.1",
153
+ version: "1.87.2",
154
154
  quality: 'oss',
155
- commit: "1.87.1",
155
+ commit: "1.87.2",
156
156
  nameShort: 'Code - OSS Dev',
157
157
  nameLong: 'Code - OSS Dev',
158
158
  applicationName: 'code-oss',
@@ -26,18 +26,25 @@ function _format(message, args) {
26
26
  function localize(data, message, ...args) {
27
27
  return _format(message, args);
28
28
  }
29
+ let initialized = false;
29
30
  let locale = undefined;
30
31
  let translations = {};
32
+ function isInitialized() {
33
+ return initialized;
34
+ }
31
35
  function setLocale(_locale, _translations) {
36
+ initialized = true;
32
37
  locale = _locale;
33
38
  translations = _translations;
34
39
  }
35
40
  function localizeWithPath(path, data, defaultMessage, ...args) {
41
+ initialized = true;
36
42
  const key = typeof data === 'object' ? data.key : data;
37
43
  const message = (translations[path] ?? {})[key] ?? defaultMessage;
38
44
  return _format(message, args);
39
45
  }
40
46
  function localize2WithPath(path, data, defaultMessage, ...args) {
47
+ initialized = true;
41
48
  const key = typeof data === 'object' ? data.key : data;
42
49
  const message = (translations[path] ?? {})[key] ?? defaultMessage;
43
50
  return {
@@ -48,4 +55,4 @@ function localize2WithPath(path, data, defaultMessage, ...args) {
48
55
  function getConfiguredDefaultLocale(_) {
49
56
  return locale;
50
57
  }
51
- export { getConfiguredDefaultLocale, localize, localize2WithPath, localizeWithPath, setLocale };
58
+ export { getConfiguredDefaultLocale, isInitialized, localize, localize2WithPath, localizeWithPath, setLocale };