@codingame/monaco-vscode-api 1.69.24 → 1.76.0-next.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.
@@ -150,17 +150,28 @@ interface UriComponents {
150
150
  fragment: string;
151
151
  }
152
152
 
153
+ interface ILocalizedString {
154
+ /**
155
+ * The localized value of the string.
156
+ */
157
+ value: string;
158
+ /**
159
+ * The original (non localized value of the string)
160
+ */
161
+ original: string;
162
+ }
163
+
153
164
  /**
154
165
  * Type of extension.
155
166
  *
156
167
  * **NOTE**: This is defined in `platform/environment` because it can appear as a CLI argument.
157
168
  */
158
- declare type ExtensionKind = 'ui' | 'workspace' | 'web';
169
+ type ExtensionKind = 'ui' | 'workspace' | 'web';
159
170
 
160
171
  interface ICommand {
161
172
  command: string;
162
- title: string;
163
- category?: string;
173
+ title: string | ILocalizedString;
174
+ category?: string | ILocalizedString;
164
175
  }
165
176
  interface IConfigurationProperty {
166
177
  description: string;
@@ -282,6 +293,7 @@ interface IWalkthroughStep {
282
293
  interface IWalkthrough {
283
294
  readonly id: string;
284
295
  readonly title: string;
296
+ readonly icon?: string;
285
297
  readonly description: string;
286
298
  readonly steps: IWalkthroughStep[];
287
299
  readonly featuredFor: string[] | undefined;
@@ -351,8 +363,8 @@ interface IExtensionCapabilities {
351
363
  readonly virtualWorkspaces?: ExtensionVirtualWorkspaceSupport;
352
364
  readonly untrustedWorkspaces?: ExtensionUntrustedWorkspaceSupport;
353
365
  }
354
- declare type LimitedWorkspaceSupportType = 'limited';
355
- declare type ExtensionUntrustedWorkspaceSupport = {
366
+ type LimitedWorkspaceSupportType = 'limited';
367
+ type ExtensionUntrustedWorkspaceSupport = {
356
368
  supported: true;
357
369
  } | {
358
370
  supported: false;
@@ -362,7 +374,7 @@ declare type ExtensionUntrustedWorkspaceSupport = {
362
374
  description: string;
363
375
  restrictedConfigurations?: string[];
364
376
  };
365
- declare type ExtensionVirtualWorkspaceSupport = boolean | {
377
+ type ExtensionVirtualWorkspaceSupport = boolean | {
366
378
  supported: true;
367
379
  } | {
368
380
  supported: false | LimitedWorkspaceSupportType;
@@ -379,6 +391,8 @@ interface IRelaxedExtensionManifest {
379
391
  description?: string;
380
392
  main?: string;
381
393
  browser?: string;
394
+ preview?: boolean;
395
+ l10n?: string;
382
396
  icon?: string;
383
397
  categories?: string[];
384
398
  keywords?: string[];
@@ -451,8 +465,11 @@ interface IRelaxedExtensionDescription extends IRelaxedExtensionManifest {
451
465
  isUserBuiltin: boolean;
452
466
  isUnderDevelopment: boolean;
453
467
  extensionLocation: URI;
468
+ browserNlsBundleUris?: {
469
+ [language: string]: URI;
470
+ };
454
471
  }
455
- declare type IExtensionDescription = Readonly<IRelaxedExtensionDescription>;
472
+ type IExtensionDescription = Readonly<IRelaxedExtensionDescription>;
456
473
 
457
474
  type IEditorOverrideServices = monaco.editor.IEditorOverrideServices
458
475
 
package/dist/snippets.js CHANGED
@@ -1,7 +1,7 @@
1
- import { b as parse, g as getNodeType } from './polyfill.js';
2
- import { f as IUserDataProfileService, I as ILifecycleService } from './missing-services.js';
1
+ import { h as isStringArray, p as parse, g as getNodeType } from './polyfill.js';
2
+ import { e as IUserDataProfileService, I as ILifecycleService } from './missing-services.js';
3
3
  import { i as ISnippetsService, S as Services, c as IFileService, j as ITextFileService } from './services2.js';
4
- import { _ as __decorate, a as __param } from './workspace.js';
4
+ import { _ as __decorate, a as __param } from './contextkey.js';
5
5
  import * as monacoSuggest from 'monaco-editor/esm/vs/editor/contrib/suggest/browser/suggest.js';
6
6
  import { extname as extname$1, basename as basename$1 } from 'monaco-editor/esm/vs/base/common/path.js';
7
7
  import { Iterable } from 'monaco-editor/esm/vs/base/common/iterator.js';
@@ -14,17 +14,16 @@ import { tail, insertInto } from 'monaco-editor/esm/vs/base/common/arrays.js';
14
14
  import { KnownSnippetVariableNames } from 'monaco-editor/esm/vs/editor/contrib/snippet/browser/snippetVariables.js';
15
15
  import { g as getExtensionPoint, a as ExtensionMessageCollector, c as consoleExtensionMessageHandler, o as onServicesInitialized, E as ExtensionsRegistry } from './tools.js';
16
16
  import { l as languagesExtPoint } from './languageService.js';
17
- import { be as DEFAULT_EXTENSION, bk as Range$2 } from './extHost.js';
17
+ import { bj as DEFAULT_EXTENSION, bs as Range$2 } from './extHost.js';
18
18
  import { CommandsRegistry } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
19
19
  import { getWordAtText } from 'monaco-editor/esm/vs/editor/common/core/wordHelper.js';
20
20
  import { isPatternInWord } from 'monaco-editor/esm/vs/base/common/filters.js';
21
- import { compareSubstring, isFalsyOrWhitespace, compare } from 'monaco-editor/esm/vs/base/common/strings.js';
21
+ import { firstNonWhitespaceIndex, compareSubstring, isFalsyOrWhitespace, compare } from 'monaco-editor/esm/vs/base/common/strings.js';
22
22
  import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
23
23
  import { ILanguageConfigurationService } from 'monaco-editor/esm/vs/editor/common/languages/languageConfigurationRegistry.js';
24
24
  import { MarkdownString } from 'monaco-editor/esm/vs/base/common/htmlContent.js';
25
25
  import { StopWatch } from 'monaco-editor/esm/vs/base/common/stopwatch.js';
26
26
  import { r as registerExtensionFile, I as IExtensionResourceLoaderService } from './files.js';
27
- import { b as isStringArray } from './types.js';
28
27
  import { DisposableStore, combinedDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
29
28
  import { ResourceMap } from 'monaco-editor/esm/vs/base/common/map.js';
30
29
  import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
@@ -255,7 +254,7 @@ class SnippetFile {
255
254
  source = ( (localize('source.userSnippet', "User Snippet")));
256
255
  }
257
256
  }
258
- for (const _prefix of Array.isArray(prefix) ? prefix : Iterable.single(prefix)) {
257
+ for (const _prefix of Iterable.wrap(prefix)) {
259
258
  bucket.push(( (new Snippet(
260
259
  Boolean(isFileTemplate),
261
260
  scopes,
@@ -298,7 +297,7 @@ class SnippetCompletion {
298
297
  this.command = { id: markSnippetAsUsed, title: '', arguments: [snippet] };
299
298
  }
300
299
  resolve() {
301
- this.documentation = ( (new MarkdownString())).appendCodeblock('', ( (new SnippetParser())).text(this.snippet.codeSnippet));
300
+ this.documentation = ( (new MarkdownString())).appendCodeblock('', SnippetParser.asInsertText(this.snippet.codeSnippet));
302
301
  return this;
303
302
  }
304
303
  static compareByLabel(a, b) {
@@ -330,7 +329,10 @@ let SnippetCompletionProvider = class SnippetCompletionProvider {
330
329
  if (wordUntil && word && !isPatternInWord(wordUntil, 0, wordUntil.length, snippet.prefixLow, 0, snippet.prefixLow.length)) {
331
330
  continue snippet;
332
331
  }
333
- column: for (let pos = Math.max(0, columnOffset - snippet.prefixLow.length); pos < lineContentLow.length; pos++) {
332
+ const minPos = firstNonWhitespaceIndex(snippet.prefixLow) === 0
333
+ ? Math.max(0, model.getLineFirstNonWhitespaceColumn(position.lineNumber) - 1)
334
+ : 0;
335
+ column: for (let pos = Math.max(minPos, columnOffset - snippet.prefixLow.length); pos < lineContentLow.length; pos++) {
334
336
  if (!isPatternInWord(lineContentLow, pos, columnOffset, snippet.prefixLow, 0, snippet.prefixLow.length)) {
335
337
  continue column;
336
338
  }
@@ -10,12 +10,28 @@ interface ServiceIdentifier<T> {
10
10
  type: T;
11
11
  }
12
12
 
13
+ /**
14
+ * An object that performs a cleanup operation when `.dispose()` is called.
15
+ *
16
+ * Some examples of how disposables are used:
17
+ *
18
+ * - An event listener that removes itself when `.dispose()` is called.
19
+ * - A resource such as a file system watcher that cleans up the resource when `.dispose()` is called.
20
+ * - The return value from registering a provider. When `.dispose()` is called, the provider is unregistered.
21
+ */
13
22
  interface IDisposable {
14
23
  dispose(): void;
15
24
  }
25
+ /**
26
+ * Manages a collection of disposable values.
27
+ *
28
+ * This is the preferred way to manage multiple disposables. A `DisposableStore` is safer to work with than an
29
+ * `IDisposable[]` as it considers edge cases, such as registering the same value multiple times or adding an item to a
30
+ * store that has already been disposed of.
31
+ */
16
32
  declare class DisposableStore implements IDisposable {
17
33
  static DISABLE_DISPOSED_WARNING: boolean;
18
- private _toDispose;
34
+ private readonly _toDispose;
19
35
  private _isDisposed;
20
36
  constructor();
21
37
  /**
@@ -25,13 +41,16 @@ declare class DisposableStore implements IDisposable {
25
41
  */
26
42
  dispose(): void;
27
43
  /**
28
- * Returns `true` if this object has been disposed
44
+ * @return `true` if this object has been disposed of.
29
45
  */
30
46
  get isDisposed(): boolean;
31
47
  /**
32
48
  * Dispose of all registered disposables but do not mark this object as disposed.
33
49
  */
34
50
  clear(): void;
51
+ /**
52
+ * Add a new {@link IDisposable disposable} to the collection.
53
+ */
35
54
  add<T extends IDisposable>(o: T): T;
36
55
  }
37
56
 
@@ -89,20 +108,50 @@ interface IObserver {
89
108
  }
90
109
 
91
110
  /**
92
- * To an event a function with one or zero parameters
93
- * can be subscribed. The event is the subscriber function itself.
111
+ * Can be passed into the Delayed to defer using a microtask
112
+ * */
113
+ declare const MicrotaskDelay: unique symbol;
114
+
115
+ /**
116
+ * An event with zero or one parameters that can be subscribed to. The event is a function itself.
94
117
  */
95
118
  type Event<T> = vscode.Event<T>
96
119
  declare namespace Event {
97
120
  const None: Event<any>;
121
+ /**
122
+ * Given an event, returns another event which debounces calls and defers the listeners to a later task via a shared
123
+ * `setTimeout`. The event is converted into a signal (`Event<void>`) to avoid additional object creation as a
124
+ * result of merging events and to try prevent race conditions that could arise when using related deferred and
125
+ * non-deferred events.
126
+ *
127
+ * This is useful for deferring non-critical work (eg. general UI updates) to ensure it does not block critical work
128
+ * (eg. latency of keypress to text rendered).
129
+ *
130
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
131
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
132
+ * returned event causes this utility to leak a listener on the original event.
133
+ *
134
+ * @param event The event source for the new event.
135
+ * @param disposable A disposable store to add the new EventEmitter to.
136
+ */
137
+ function defer(event: Event<unknown>, disposable?: DisposableStore): Event<void>;
98
138
  /**
99
139
  * Given an event, returns another event which only fires once.
140
+ *
141
+ * @param event The event source for the new event.
100
142
  */
101
143
  function once<T>(event: Event<T>): Event<T>;
102
144
  /**
145
+ * Maps an event of one type into an event of another type using a mapping function, similar to how
146
+ * `Array.prototype.map` works.
147
+ *
103
148
  * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
104
149
  * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
105
150
  * returned event causes this utility to leak a listener on the original event.
151
+ *
152
+ * @param event The event source for the new event.
153
+ * @param map The mapping function.
154
+ * @param disposable A disposable store to add the new EventEmitter to.
106
155
  */
107
156
  function map<I, O>(event: Event<I>, map: (i: I) => O, disposable?: DisposableStore): Event<O>;
108
157
  /**
@@ -136,17 +185,33 @@ declare namespace Event {
136
185
  */
137
186
  function reduce<I, O>(event: Event<I>, merge: (last: O | undefined, event: I) => O, initial?: O, disposable?: DisposableStore): Event<O>;
138
187
  /**
188
+ * Given an event, creates a new emitter that event that will debounce events based on {@link delay} and give an
189
+ * array event object of all events that fired.
190
+ *
139
191
  * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
140
192
  * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
141
193
  * returned event causes this utility to leak a listener on the original event.
142
- */
143
- function debounce<T>(event: Event<T>, merge: (last: T | undefined, event: T) => T, delay?: number, leading?: boolean, leakWarningThreshold?: number, disposable?: DisposableStore): Event<T>;
144
- /**
194
+ *
195
+ * @param event The original event to debounce.
196
+ * @param merge A function that reduces all events into a single event.
197
+ * @param delay The number of milliseconds to debounce.
198
+ * @param leading Whether to fire a leading event without debouncing.
199
+ * @param flushOnListenerRemove Whether to fire all debounced events when a listener is removed. If this is not
200
+ * specified, some events could go missing. Use this if it's important that all events are processed, even if the
201
+ * listener gets disposed before the debounced event fires.
202
+ * @param leakWarningThreshold See {@link EmitterOptions.leakWarningThreshold}.
203
+ * @param disposable A disposable store to register the debounce emitter to.
204
+ */
205
+ function debounce<T>(event: Event<T>, merge: (last: T | undefined, event: T) => T, delay?: number | typeof MicrotaskDelay, leading?: boolean, flushOnListenerRemove?: boolean, leakWarningThreshold?: number, disposable?: DisposableStore): Event<T>;
206
+ function debounce<I, O>(event: Event<I>, merge: (last: O | undefined, event: I) => O, delay?: number | typeof MicrotaskDelay, leading?: boolean, flushOnListenerRemove?: boolean, leakWarningThreshold?: number, disposable?: DisposableStore): Event<O>;
207
+ /**
208
+ * Debounces an event, firing after some delay (default=0) with an array of all event original objects.
209
+ *
145
210
  * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
146
211
  * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
147
212
  * returned event causes this utility to leak a listener on the original event.
148
213
  */
149
- function debounce<I, O>(event: Event<I>, merge: (last: O | undefined, event: I) => O, delay?: number, leading?: boolean, leakWarningThreshold?: number, disposable?: DisposableStore): Event<O>;
214
+ function accumulate<T>(event: Event<T>, delay?: number, disposable?: DisposableStore): Event<T[]>;
150
215
  /**
151
216
  * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
152
217
  * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
@@ -154,9 +219,21 @@ declare namespace Event {
154
219
  */
155
220
  function latch<T>(event: Event<T>, equals?: (a: T, b: T) => boolean, disposable?: DisposableStore): Event<T>;
156
221
  /**
222
+ * Splits an event whose parameter is a union type into 2 separate events for each type in the union.
223
+ *
157
224
  * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
158
225
  * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
159
226
  * returned event causes this utility to leak a listener on the original event.
227
+ *
228
+ * @example
229
+ * ```
230
+ * const event = new EventEmitter<number | undefined>().event;
231
+ * const [numberEvent, undefinedEvent] = Event.split(event, isUndefined);
232
+ * ```
233
+ *
234
+ * @param event The event source for the new event.
235
+ * @param isT A function that determines what event is of the first type.
236
+ * @param disposable A disposable store to add the new EventEmitter to.
160
237
  */
161
238
  function split<T, U>(event: Event<T | U>, isT: (e: T | U) => e is T, disposable?: DisposableStore): [Event<T>, Event<U>];
162
239
  /**
@@ -173,8 +250,8 @@ declare namespace Event {
173
250
  filter<R>(fn: (e: T | R) => e is R): IChainableEvent<R>;
174
251
  reduce<R>(merge: (last: R | undefined, event: T) => R, initial?: R): IChainableEvent<R>;
175
252
  latch(): IChainableEvent<T>;
176
- debounce(merge: (last: T | undefined, event: T) => T, delay?: number, leading?: boolean, leakWarningThreshold?: number): IChainableEvent<T>;
177
- debounce<R>(merge: (last: R | undefined, event: T) => R, delay?: number, leading?: boolean, leakWarningThreshold?: number): IChainableEvent<R>;
253
+ debounce(merge: (last: T | undefined, event: T) => T, delay?: number, leading?: boolean, flushOnListenerRemove?: boolean, leakWarningThreshold?: number): IChainableEvent<T>;
254
+ debounce<R>(merge: (last: R | undefined, event: T) => R, delay?: number, leading?: boolean, flushOnListenerRemove?: boolean, leakWarningThreshold?: number): IChainableEvent<R>;
178
255
  on(listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore): IDisposable;
179
256
  once(listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[]): IDisposable;
180
257
  }
@@ -345,17 +422,28 @@ interface UriComponents {
345
422
  fragment: string;
346
423
  }
347
424
 
425
+ interface ILocalizedString {
426
+ /**
427
+ * The localized value of the string.
428
+ */
429
+ value: string;
430
+ /**
431
+ * The original (non localized value of the string)
432
+ */
433
+ original: string;
434
+ }
435
+
348
436
  /**
349
437
  * Type of extension.
350
438
  *
351
439
  * **NOTE**: This is defined in `platform/environment` because it can appear as a CLI argument.
352
440
  */
353
- declare type ExtensionKind = 'ui' | 'workspace' | 'web';
441
+ type ExtensionKind = 'ui' | 'workspace' | 'web';
354
442
 
355
443
  interface ICommand {
356
444
  command: string;
357
- title: string;
358
- category?: string;
445
+ title: string | ILocalizedString;
446
+ category?: string | ILocalizedString;
359
447
  }
360
448
  interface IConfigurationProperty {
361
449
  description: string;
@@ -477,6 +565,7 @@ interface IWalkthroughStep {
477
565
  interface IWalkthrough {
478
566
  readonly id: string;
479
567
  readonly title: string;
568
+ readonly icon?: string;
480
569
  readonly description: string;
481
570
  readonly steps: IWalkthroughStep[];
482
571
  readonly featuredFor: string[] | undefined;
@@ -546,8 +635,8 @@ interface IExtensionCapabilities {
546
635
  readonly virtualWorkspaces?: ExtensionVirtualWorkspaceSupport;
547
636
  readonly untrustedWorkspaces?: ExtensionUntrustedWorkspaceSupport;
548
637
  }
549
- declare type LimitedWorkspaceSupportType = 'limited';
550
- declare type ExtensionUntrustedWorkspaceSupport = {
638
+ type LimitedWorkspaceSupportType = 'limited';
639
+ type ExtensionUntrustedWorkspaceSupport = {
551
640
  supported: true;
552
641
  } | {
553
642
  supported: false;
@@ -557,7 +646,7 @@ declare type ExtensionUntrustedWorkspaceSupport = {
557
646
  description: string;
558
647
  restrictedConfigurations?: string[];
559
648
  };
560
- declare type ExtensionVirtualWorkspaceSupport = boolean | {
649
+ type ExtensionVirtualWorkspaceSupport = boolean | {
561
650
  supported: true;
562
651
  } | {
563
652
  supported: false | LimitedWorkspaceSupportType;
@@ -574,6 +663,8 @@ interface IRelaxedExtensionManifest {
574
663
  description?: string;
575
664
  main?: string;
576
665
  browser?: string;
666
+ preview?: boolean;
667
+ l10n?: string;
577
668
  icon?: string;
578
669
  categories?: string[];
579
670
  keywords?: string[];
@@ -646,13 +737,16 @@ interface IRelaxedExtensionDescription extends IRelaxedExtensionManifest {
646
737
  isUserBuiltin: boolean;
647
738
  isUnderDevelopment: boolean;
648
739
  extensionLocation: URI;
740
+ browserNlsBundleUris?: {
741
+ [language: string]: URI;
742
+ };
649
743
  }
650
- declare type IExtensionDescription = Readonly<IRelaxedExtensionDescription>;
744
+ type IExtensionDescription = Readonly<IRelaxedExtensionDescription>;
651
745
 
652
746
  type IEditorOverrideServices = monaco.editor.IEditorOverrideServices
653
747
 
654
- declare const ITextMateService: ServiceIdentifier<ITextMateService>;
655
- interface ITextMateService {
748
+ declare const ITextMateTokenizationService: ServiceIdentifier<ITextMateTokenizationService>;
749
+ interface ITextMateTokenizationService {
656
750
  readonly _serviceBrand: undefined;
657
751
  onDidEncounterLanguage: Event<string>;
658
752
  createGrammar(languageId: string): Promise<IGrammar$1 | null>;
@@ -680,4 +774,4 @@ type PartialITMSyntaxExtensionPoint = Partial<ITMSyntaxExtensionPoint> & Pick<IT
680
774
  declare function setGrammars<T extends PartialITMSyntaxExtensionPoint>(grammars: T[], getContent: (grammar: T) => Promise<string>, extension?: IExtensionDescription): void;
681
775
  declare function getServiceOverride(getOnigLib: () => Promise<Response | ArrayBuffer>): IEditorOverrideServices;
682
776
 
683
- export { PartialITMSyntaxExtensionPoint as ITMSyntaxExtensionPoint, ITextMateService, getServiceOverride as default, setGrammars };
777
+ export { PartialITMSyntaxExtensionPoint as ITMSyntaxExtensionPoint, ITextMateTokenizationService, getServiceOverride as default, setGrammars };