@codingame/monaco-vscode-api 1.69.0 → 1.69.3

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/dist/theme.d.ts CHANGED
@@ -15,8 +15,9 @@ interface IThemeExtensionPoint {
15
15
 
16
16
  type IEditorOverrideServices = monaco.editor.IEditorOverrideServices
17
17
 
18
- declare function setThemes<T extends IThemeExtensionPoint>(_themes: T[], getContent: (theme: T) => Promise<string>): void;
19
- declare function setDefaultThemes<T extends IThemeExtensionPoint>(_themes: T[], getContent: (theme: T) => Promise<string>): void;
18
+ declare type PartialIThemeExtensionPoint = Partial<IThemeExtensionPoint> & Pick<IThemeExtensionPoint, 'id' | 'path'>;
19
+ declare function setThemes<T extends PartialIThemeExtensionPoint>(_themes: T[], getContent: (theme: T) => Promise<string>): void;
20
+ declare function setDefaultThemes<T extends PartialIThemeExtensionPoint>(_themes: T[], getContent: (theme: T) => Promise<string>): void;
20
21
  declare function getServiceOverride(): IEditorOverrideServices;
21
22
 
22
- export { IThemeExtensionPoint, getServiceOverride as default, setDefaultThemes, setThemes };
23
+ export { PartialIThemeExtensionPoint as IThemeExtensionPoint, getServiceOverride as default, setDefaultThemes, setThemes };
package/dist/theme.js CHANGED
@@ -1,5 +1,5 @@
1
- import { I as IExtensionService, T as IBrowserWorkbenchEnvironmentService, V as IHostColorSchemeService, W as IUserDataInitializationService, M as ExtensionsRegistry, E as Emitter, X as Sequencer, O as ExtensionMessageCollector, P as parse$1, S as getNodeType } from './missing-services.js';
2
- import { _ as __decorate, a as __param } from './tslib.es6.js';
1
+ import { I as IExtensionService, T as IBrowserWorkbenchEnvironmentService, V as IHostColorSchemeService, W as IUserDataInitializationService, h as ExtensionsRegistry, E as Emitter, X as Sequencer, O as ExtensionMessageCollector, P as parse$1, S as getNodeType } from './missing-services.js';
2
+ import { _ as __decorate, a as __param } from './contextkey.js';
3
3
  import { V as VS_DARK_THEME, a as VS_LIGHT_THEME, b as VS_HC_THEME, c as VS_HC_LIGHT_THEME, T as ThemeSettings, E as ExtensionData, d as THEME_SCOPE_OPEN_PAREN, e as THEME_SCOPE_CLOSE_PAREN, f as THEME_SCOPE_WILDCARD, t as themeScopeRegex } from './workbenchThemeService.js';
4
4
  import { workbenchColorsSchemaId, editorBackground, editorForeground, editorSelectionBackground, editorInactiveSelection, editorSelectionHighlight, editorFindMatchHighlight, editorFindMatch, editorHoverHighlight, editorFindRangeHighlight, asCssVariableName, Extensions as Extensions$2 } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
5
5
  import { Color } from 'monaco-editor/esm/vs/base/common/color.js';
@@ -1,11 +1,9 @@
1
- import { M as ExtensionsRegistry, O as ExtensionMessageCollector } from './missing-services.js';
1
+ import { h as ExtensionsRegistry, O as ExtensionMessageCollector } from './missing-services.js';
2
2
  import { g as getTokenClassificationRegistry, a as typeAndModifierIdPattern } from './tokenClassificationRegistry.js';
3
3
  import { localize } from 'monaco-editor/esm/vs/nls.js';
4
- import { g as getExtensionPoint, c as consoleExtensionMessageHandler } from './tools.js';
4
+ import { g as getExtensionPoint, c as consoleExtensionMessageHandler, o as onServicesInitialized } from './tools.js';
5
5
  import { S as Services } from './services2.js';
6
6
  import { bd as DEFAULT_EXTENSION } from './extHost.js';
7
- import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
8
- import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
9
7
  const tokenClassificationRegistry = getTokenClassificationRegistry();
10
8
  const tokenTypeExtPoint$1 = ( ExtensionsRegistry.registerExtensionPoint({
11
9
  extensionPoint: 'semanticTokenTypes',
@@ -294,11 +292,11 @@ function setTokenStyleDefaults(tokenStyleDefaults, extension = Services.get().ex
294
292
  collector: new ExtensionMessageCollector(consoleExtensionMessageHandler, extension, tokenModifierExtPoint.name)
295
293
  }]);
296
294
  }
297
- function register() {
298
- StandaloneServices.get(IInstantiationService).createInstance(TokenClassificationExtensionPoints);
295
+ function initialize(instantiationService) {
296
+ instantiationService.createInstance(TokenClassificationExtensionPoints);
299
297
  }
300
298
  function getServiceOverride() {
301
- setTimeout(register);
299
+ onServicesInitialized(initialize);
302
300
  return {};
303
301
  }
304
302
  export { getServiceOverride as default, setTokenModifiers, setTokenStyleDefaults, setTokenTypes };
package/dist/tools.js CHANGED
@@ -1,4 +1,6 @@
1
- import { M as ExtensionsRegistry } from './missing-services.js';
1
+ import { h as ExtensionsRegistry } from './missing-services.js';
2
+ import { EventEmitter } from 'vscode';
3
+ import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
2
4
  import Severity from 'monaco-editor/esm/vs/base/common/severity.js';
3
5
  function consoleExtensionMessageHandler(msg) {
4
6
  if (msg.type === Severity.Error) {
@@ -14,4 +16,16 @@ function consoleExtensionMessageHandler(msg) {
14
16
  function getExtensionPoint(extensionPoint) {
15
17
  return ExtensionsRegistry.getExtensionPoints().find(ep => ep.name === extensionPoint);
16
18
  }
17
- export { consoleExtensionMessageHandler as c, getExtensionPoint as g };
19
+ const emitter = new EventEmitter();
20
+ const onServicesInitialized = emitter.event;
21
+ let initialized = false;
22
+ const original = StandaloneServices.initialize;
23
+ StandaloneServices.initialize = (overrides) => {
24
+ const instantiationService = original.call(StandaloneServices, overrides);
25
+ if (!initialized) {
26
+ initialized = true;
27
+ emitter.fire(instantiationService);
28
+ }
29
+ return instantiationService;
30
+ };
31
+ export { consoleExtensionMessageHandler as c, getExtensionPoint as g, onServicesInitialized as o };
@@ -0,0 +1,49 @@
1
+ import { u as unsupported } from './missing-services.js';
2
+ import { S as Services } from './services2.js';
3
+ import { IWorkspaceContextService, WorkspaceFolder } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
4
+ import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
5
+ import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
6
+ class SimpleWorkspaceContextService {
7
+ constructor() {
8
+ this.onDidChangeWorkspaceName = Event.None;
9
+ this.onWillChangeWorkspaceFolders = Event.None;
10
+ this.onDidChangeWorkspaceFolders = Event.None;
11
+ this.onDidChangeWorkbenchState = Event.None;
12
+ this.isCurrentWorkspace = unsupported;
13
+ }
14
+ getCompleteWorkspace() {
15
+ return Promise.resolve(this.getWorkspace());
16
+ }
17
+ getWorkspace() {
18
+ const workspaceFolders = Services.get().workspace?.workspaceFolders;
19
+ return {
20
+ id: '4064f6ec-cb38-4ad0-af64-ee6467e63c82',
21
+ folders: workspaceFolders?.map(folder => new WorkspaceFolder(folder)) ?? []
22
+ };
23
+ }
24
+ getWorkbenchState() {
25
+ const workspaceFoldersCount = Services.get().workspace?.workspaceFolders?.length ?? 1;
26
+ if (workspaceFoldersCount === 0) {
27
+ return 1 ;
28
+ }
29
+ else if (workspaceFoldersCount === 1) {
30
+ return 2 ;
31
+ }
32
+ else {
33
+ return 3 ;
34
+ }
35
+ }
36
+ getWorkspaceFolder(resource) {
37
+ const workspace = this.getWorkspace();
38
+ return workspace.folders.find(folder => folder.uri.scheme === resource.scheme && resource.path.startsWith(folder.uri.path)) ?? null;
39
+ }
40
+ isInsideWorkspace(resource) {
41
+ return this.getWorkspaceFolder(resource) != null;
42
+ }
43
+ }
44
+ function getServiceOverride() {
45
+ return {
46
+ [( IWorkspaceContextService.toString())]: new SyncDescriptor(SimpleWorkspaceContextService)
47
+ };
48
+ }
49
+ export { getServiceOverride as g };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-api",
3
- "version": "1.69.0",
3
+ "version": "1.69.3",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor",
6
6
  "keywords": [],
@@ -134,16 +134,16 @@
134
134
  "@babel/preset-typescript": "^7.18.6",
135
135
  "@codingame/eslint-config": "^1.1.6",
136
136
  "@codingame/tsconfig": "^1.1.0",
137
- "@octokit/rest": "^19.0.3",
137
+ "@octokit/rest": "^19.0.4",
138
138
  "@rollup/plugin-node-resolve": "^13.3.0",
139
139
  "@rollup/plugin-replace": "^4.0.0",
140
140
  "@rollup/plugin-typescript": "^8.3.4",
141
141
  "@types/babel__core": "^7.1.19",
142
- "@types/semver": "^7.3.10",
142
+ "@types/semver": "^7.3.12",
143
143
  "@types/vscode": "~1.69.1",
144
- "@typescript-eslint/eslint-plugin": "^5.32.0",
145
- "@typescript-eslint/parser": "^5.32.0",
146
- "eslint": "^8.21.0",
144
+ "@typescript-eslint/eslint-plugin": "^5.33.1",
145
+ "@typescript-eslint/parser": "^5.33.1",
146
+ "eslint": "^8.22.0",
147
147
  "eslint-config-standard": "^17.0.0",
148
148
  "eslint-plugin-import": "^2.26.0",
149
149
  "eslint-plugin-n": "^15.2.4",
@@ -151,7 +151,7 @@
151
151
  "eslint-plugin-unused-imports": "^2.0.0",
152
152
  "js-cleanup": "^1.2.0",
153
153
  "recast": "^0.21.2",
154
- "rollup": "^2.77.2",
154
+ "rollup": "^2.78.1",
155
155
  "rollup-plugin-dts": "^4.2.2",
156
156
  "rollup-plugin-styles": "^4.0.0",
157
157
  "semver": "^7.3.7",
package/dist/tslib.es6.js DELETED
@@ -1,21 +0,0 @@
1
- function __decorate(decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- }
7
- function __param(paramIndex, decorator) {
8
- return function (target, key) { decorator(target, key, paramIndex); }
9
- }
10
- function __classPrivateFieldGet(receiver, state, kind, f) {
11
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
12
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
13
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
14
- }
15
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
16
- if (kind === "m") throw new TypeError("Private method is not writable");
17
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
18
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
19
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
20
- }
21
- export { __decorate as _, __param as a, __classPrivateFieldSet as b, __classPrivateFieldGet as c };