@codingame/monaco-vscode-editor-api 23.3.0 → 24.1.1

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.
@@ -1,36 +1,7 @@
1
1
  import { createModelReference, writeFile } from "@codingame/monaco-vscode-api/monaco";
2
- import type { IInternalWebWorkerOptions, MonacoWebWorker } from "../../../vscode/src/vs/editor/standalone/browser/standaloneWebWorker.js";
3
2
  export * from "../../../vscode/src/vs/editor/editor.api.js";
4
3
  declare module "../../../vscode/src/vs/editor/editor.api.js" {
5
4
  namespace editor {
6
5
  export { createModelReference, writeFile };
7
6
  }
8
7
  }
9
- /**
10
- * Make the `createWebWorker` method backward compatible, until the monaco standalone workers are updated
11
- */
12
- export interface IWebWorkerOptions {
13
- /**
14
- * The AMD moduleId to load.
15
- * It should export a function `create` that should return the exported proxy.
16
- */
17
- moduleId: string;
18
- /**
19
- * The data to send over when calling create on the module.
20
- */
21
- createData?: unknown;
22
- /**
23
- * A label to be used to identify the web worker for debugging purposes.
24
- */
25
- label?: string;
26
- /**
27
- * An object that can be used by the web worker to make calls back to the main thread.
28
- */
29
- host?: Record<string, Function>;
30
- /**
31
- * Keep idle models.
32
- * Defaults to false, which means that idle models will stop syncing after a while.
33
- */
34
- keepIdleModels?: boolean;
35
- }
36
- export declare function createWebWorker<T extends object>(options: IWebWorkerOptions | IInternalWebWorkerOptions): MonacoWebWorker<T>;
@@ -3,8 +3,6 @@ import { languages, editor } from '../../../vscode/src/vs/editor/editor.api.js';
3
3
  export { CancellationTokenSource, Emitter, KeyCode, KeyMod, MarkerSeverity, MarkerTag, Position, Range, Selection, SelectionDirection, Token, Uri } from '../../../vscode/src/vs/editor/editor.api.js';
4
4
  import { createConfiguredEditor, createConfiguredDiffEditor, createModelReference, writeFile } from '@codingame/monaco-vscode-api/monaco';
5
5
  import { withReadyServices } from '@codingame/monaco-vscode-api/services';
6
- import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
7
- import { createWebWorker as createWebWorker$1 } from '../../../vscode/src/vs/editor/standalone/browser/standaloneEditor.js';
8
6
 
9
7
  const originalOnLanguage = languages.onLanguage;
10
8
  languages.onLanguage = (languageId, callback) => withReadyServices(() => originalOnLanguage(languageId, callback));
@@ -14,46 +12,5 @@ editor.create = createConfiguredEditor;
14
12
  editor.createDiffEditor = createConfiguredDiffEditor;
15
13
  editor.createModelReference = createModelReference;
16
14
  editor.writeFile = writeFile;
17
- let id = 0;
18
- function getWorker(descriptor) {
19
- const label = descriptor.label || 'anonymous' + ++id;
20
- const monacoEnvironment = globalThis.MonacoEnvironment;
21
- if (monacoEnvironment) {
22
- if (typeof monacoEnvironment.getWorker === 'function') {
23
- return monacoEnvironment.getWorker('workerMain.js', label);
24
- }
25
- if (typeof monacoEnvironment.getWorkerUrl === 'function') {
26
- const workerUrl = monacoEnvironment.getWorkerUrl('workerMain.js', label);
27
- return new Worker(workerUrl, { name: label, type: 'module' });
28
- }
29
- }
30
- throw new Error(`You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker`);
31
- }
32
- function isIWebWorkerOptions(options) {
33
- return 'moduleId' in options;
34
- }
35
- const originalCreateWebWorker = editor.createWebWorker;
36
- function createWebWorker(options) {
37
- if (isIWebWorkerOptions(options)) {
38
- const worker = getWorker({
39
- esmModuleLocation: URI.parse(options.moduleId),
40
- label: options.label
41
- });
42
- const webworker = createWebWorker$1({
43
- worker,
44
- host: options.host,
45
- keepIdleModels: options.keepIdleModels
46
- });
47
- void (async () => {
48
- const proxy = await webworker.getProxy();
49
- proxy.$initialize(options.createData);
50
- })();
51
- return webworker;
52
- }
53
- else {
54
- return originalCreateWebWorker(options);
55
- }
56
- }
57
- editor.createWebWorker = createWebWorker;
58
15
 
59
- export { createWebWorker, editor, languages };
16
+ export { editor, languages };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-editor-api",
3
- "version": "23.3.0",
3
+ "version": "24.1.1",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - monaco-editor compatible api",
6
6
  "keywords": [],
@@ -15,8 +15,7 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-5452e2b7-9081-5f95-839b-4ab3544ce28f-common": "23.3.0",
19
- "@codingame/monaco-vscode-api": "23.3.0"
18
+ "@codingame/monaco-vscode-api": "24.1.1"
20
19
  },
21
20
  "exports": {
22
21
  ".": "./esm/vs/editor/editor.api.js",
@@ -21,12 +21,16 @@ export interface Environment {
21
21
  * A web worker factory.
22
22
  * NOTE: If `getWorker` is defined, `getWorkerUrl` is not invoked.
23
23
  */
24
- getWorker?(workerId: string, label: string): Promise<Worker> | Worker;
24
+ getWorker?(workerId: string, label: string): Promise<Worker> | Worker | undefined;
25
25
  /**
26
26
  * Return the location for web worker scripts.
27
27
  * NOTE: If `getWorker` is defined, `getWorkerUrl` is not invoked.
28
28
  */
29
- getWorkerUrl?(workerId: string, label: string): string;
29
+ getWorkerUrl?(workerId: string, label: string): string | undefined;
30
+ /**
31
+ * Return the options for web worker scripts.
32
+ */
33
+ getWorkerOptions?(moduleId: string, label: string): WorkerOptions | undefined;
30
34
  /**
31
35
  * Create a trusted types policy (same API as window.trustedTypes.createPolicy)
32
36
  */
@@ -87,7 +91,7 @@ export interface CancellationToken {
87
91
  *
88
92
  * @event
89
93
  */
90
- readonly onCancellationRequested: (listener: (e: any) => any, thisArgs?: any, disposables?: IDisposable[]) => IDisposable;
94
+ readonly onCancellationRequested: (listener: (e: void) => unknown, thisArgs?: unknown, disposables?: IDisposable[]) => IDisposable;
91
95
  }
92
96
  /**
93
97
  * Uniform Resource Identifier (Uri) http://tools.ietf.org/html/rfc3986.
@@ -4102,9 +4106,9 @@ export namespace editor {
4102
4106
  export interface IEditorHoverOptions {
4103
4107
  /**
4104
4108
  * Enable the hover.
4105
- * Defaults to true.
4109
+ * Defaults to 'on'.
4106
4110
  */
4107
- enabled?: boolean;
4111
+ enabled?: "on" | "off" | "onKeyboardModifier";
4108
4112
  /**
4109
4113
  * Delay for showing the hover.
4110
4114
  * Defaults to 300.
@@ -5375,6 +5379,11 @@ export namespace editor {
5375
5379
  * Render this content widget in a location where it could overflow the editor's view dom node.
5376
5380
  */
5377
5381
  allowEditorOverflow?: boolean;
5382
+ /**
5383
+ * If true, this widget doesn't have a visual representation.
5384
+ * The element will have display set to 'none'.
5385
+ */
5386
+ useDisplayNone?: boolean;
5378
5387
  /**
5379
5388
  * Call preventDefault() on mousedown events that target the content widget.
5380
5389
  */
@@ -5460,7 +5469,7 @@ export namespace editor {
5460
5469
  * When set, stacks with other overlay widgets with the same preference,
5461
5470
  * in an order determined by the ordinal value.
5462
5471
  */
5463
- stackOridinal?: number;
5472
+ stackOrdinal?: number;
5464
5473
  }
5465
5474
  /**
5466
5475
  * An overlay widgets renders on top of the text.
@@ -5886,6 +5895,7 @@ export namespace editor {
5886
5895
  * Fires after the editor completes the operation it fired `onBeginUpdate` for.
5887
5896
  */
5888
5897
  readonly onEndUpdate: IEvent<void>;
5898
+ readonly onDidChangeViewZones: IEvent<void>;
5889
5899
  /**
5890
5900
  * Saves current view state of the editor in a serializable object.
5891
5901
  */
@@ -6019,6 +6029,10 @@ export namespace editor {
6019
6029
  * @param command The commands to execute
6020
6030
  */
6021
6031
  executeCommands(source: string | null | undefined, commands: (ICommand | null)[]): void;
6032
+ /**
6033
+ * Scroll vertically or horizontally as necessary and reveal the current cursors.
6034
+ */
6035
+ revealAllCursors(revealHorizontal: boolean, minimalReveal?: boolean): void;
6022
6036
  /**
6023
6037
  * Get all the decorations on a line (filtering out decorations from other editors).
6024
6038
  */
@@ -6128,6 +6142,7 @@ export namespace editor {
6128
6142
  * Use this method with caution.
6129
6143
  */
6130
6144
  getOffsetForColumn(lineNumber: number, column: number): number;
6145
+ getWidthOfLine(lineNumber: number): number;
6131
6146
  /**
6132
6147
  * Force an editor render now.
6133
6148
  */
@@ -7159,6 +7174,14 @@ export namespace languages {
7159
7174
  readonly requestIssuedDateTime: number;
7160
7175
  readonly earliestShownDateTime: number;
7161
7176
  }
7177
+ export interface IInlineCompletionModelInfo {
7178
+ models: IInlineCompletionModel[];
7179
+ currentModelId: string;
7180
+ }
7181
+ export interface IInlineCompletionModel {
7182
+ name: string;
7183
+ id: string;
7184
+ }
7162
7185
  export class SelectedSuggestionInfo {
7163
7186
  readonly range: IRange;
7164
7187
  readonly text: string;
@@ -7216,11 +7239,14 @@ export namespace languages {
7216
7239
  /** Only show the inline suggestion when the cursor is in the showRange. */
7217
7240
  readonly showRange?: IRange;
7218
7241
  readonly warning?: InlineCompletionWarning;
7219
- readonly hint?: InlineCompletionHint;
7242
+ readonly hint?: IInlineCompletionHint;
7243
+ readonly supportsRename?: boolean;
7220
7244
  /**
7221
7245
  * Used for telemetry.
7222
7246
  */
7223
7247
  readonly correlationId?: string | undefined;
7248
+ readonly jumpToPosition?: IPosition;
7249
+ readonly doNotLog?: boolean;
7224
7250
  }
7225
7251
  export interface InlineCompletionWarning {
7226
7252
  message: IMarkdownString | string;
@@ -7230,12 +7256,11 @@ export namespace languages {
7230
7256
  Code = 1,
7231
7257
  Label = 2
7232
7258
  }
7233
- export interface InlineCompletionHint {
7259
+ export interface IInlineCompletionHint {
7234
7260
  /** Refers to the current document. */
7235
7261
  range: IRange;
7236
7262
  style: InlineCompletionHintStyle;
7237
7263
  content: string;
7238
- jumpToEdit: boolean;
7239
7264
  }
7240
7265
  export type IconPath = editor.ThemeIcon;
7241
7266
  export interface InlineCompletions<TItem extends InlineCompletion = InlineCompletion> {
@@ -7294,6 +7319,9 @@ export namespace languages {
7294
7319
  excludesGroupIds?: InlineCompletionProviderGroupId[];
7295
7320
  displayName?: string;
7296
7321
  debounceDelayMs?: number;
7322
+ modelInfo?: IInlineCompletionModelInfo;
7323
+ onDidModelInfoChange?: IEvent<void>;
7324
+ setModelId?(modelId: string): Promise<void>;
7297
7325
  toString?(): string;
7298
7326
  }
7299
7327
  export type InlineCompletionsDisposeReason = {
@@ -7324,6 +7352,7 @@ export namespace languages {
7324
7352
  shownDuration: number;
7325
7353
  shownDurationUncollapsed: number;
7326
7354
  timeUntilShown: number | undefined;
7355
+ timeUntilActuallyShown: number | undefined;
7327
7356
  timeUntilProviderRequest: number;
7328
7357
  timeUntilProviderResponse: number;
7329
7358
  notShownReason: string | undefined;
@@ -7332,6 +7361,7 @@ export namespace languages {
7332
7361
  preceeded: boolean;
7333
7362
  languageId: string;
7334
7363
  requestReason: string;
7364
+ performanceMarkers?: string;
7335
7365
  cursorColumnDistance?: number;
7336
7366
  cursorLineDistance?: number;
7337
7367
  lineCountOriginal?: number;
@@ -7344,6 +7374,16 @@ export namespace languages {
7344
7374
  typingIntervalCharacterCount: number;
7345
7375
  selectedSuggestionInfo: boolean;
7346
7376
  availableProviders: string;
7377
+ skuPlan: string | undefined;
7378
+ skuType: string | undefined;
7379
+ renameCreated: boolean;
7380
+ renameDuration: number | undefined;
7381
+ renameTimedOut: boolean;
7382
+ renameDroppedOtherEdits: number | undefined;
7383
+ renameDroppedRenameEdits: number | undefined;
7384
+ editKind: string | undefined;
7385
+ longDistanceHintVisible?: boolean;
7386
+ longDistanceHintDistance?: number;
7347
7387
  };
7348
7388
  export interface CodeAction {
7349
7389
  title: string;
@@ -13,7 +13,7 @@ import { IEditorOverrideServices } from "@codingame/monaco-vscode-api/vscode/vs/
13
13
  import { IStandaloneThemeData } from "@codingame/monaco-vscode-api/vscode/vs/editor/standalone/common/standaloneTheme";
14
14
  import { ICommandHandler } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands";
15
15
  import { IMarker, IMarkerData } from "@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers";
16
- import { MultiDiffEditorWidget } from "@codingame/monaco-vscode-5452e2b7-9081-5f95-839b-4ab3544ce28f-common/vscode/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidget";
16
+ import { MultiDiffEditorWidget } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidget";
17
17
  /**
18
18
  * Create a new editor under `domElement`.
19
19
  * `domElement` should be empty (not contain other dom nodes).
@@ -30,7 +30,8 @@ import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/
30
30
  import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
31
31
  import { IMarkerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers.service';
32
32
  import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
33
- import { MultiDiffEditorWidget } from '@codingame/monaco-vscode-5452e2b7-9081-5f95-839b-4ab3544ce28f-common/vscode/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidget';
33
+ import { MultiDiffEditorWidget } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidget';
34
+ import { IWebWorkerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/webWorker/browser/webWorkerService.service';
34
35
 
35
36
  registerCss(standaloneTokens);
36
37
  function create(domElement, options, override) {
@@ -185,7 +186,7 @@ function onDidChangeModelLanguage(listener) {
185
186
  });
186
187
  }
187
188
  function createWebWorker(opts) {
188
- return createWebWorker$1(StandaloneServices.get(IModelService), opts);
189
+ return createWebWorker$1(StandaloneServices.get(IModelService), StandaloneServices.get(IWebWorkerService), opts);
189
190
  }
190
191
  function colorizeElement(domNode, options) {
191
192
  const languageService = StandaloneServices.get(ILanguageService);
@@ -1,10 +1,11 @@
1
1
  import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
2
+ import { IWebWorkerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/webWorker/browser/webWorkerService.service";
2
3
  import { IModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service";
3
4
  /**
4
5
  * Create a new web worker that has model syncing capabilities built in.
5
6
  * Specify an AMD module to load that will `create` an object that will be proxied.
6
7
  */
7
- export declare function createWebWorker<T extends object>(modelService: IModelService, opts: IInternalWebWorkerOptions): MonacoWebWorker<T>;
8
+ export declare function createWebWorker<T extends object>(modelService: IModelService, webWorkerService: IWebWorkerService, opts: IInternalWebWorkerOptions): MonacoWebWorker<T>;
8
9
  /**
9
10
  * A web worker that can provide a proxy to an arbitrary file.
10
11
  */
@@ -1,12 +1,12 @@
1
1
 
2
2
  import { EditorWorkerClient } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/editorWorkerService';
3
3
 
4
- function createWebWorker(modelService, opts) {
5
- return ( new MonacoWebWorkerImpl(modelService, opts));
4
+ function createWebWorker(modelService, webWorkerService, opts) {
5
+ return ( new MonacoWebWorkerImpl(modelService, webWorkerService, opts));
6
6
  }
7
7
  class MonacoWebWorkerImpl extends EditorWorkerClient {
8
- constructor(modelService, opts) {
9
- super(opts.worker, opts.keepIdleModels || false, modelService);
8
+ constructor(modelService, webWorkerService, opts) {
9
+ super(opts.worker, opts.keepIdleModels || false, modelService, webWorkerService);
10
10
  this._foreignModuleHost = opts.host || null;
11
11
  this._foreignProxy = this._getProxy().then(proxy => {
12
12
  return ( new Proxy({}, {