@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.
package/dist/files.js CHANGED
@@ -1,23 +1,22 @@
1
- import { _ as __decorate, a as __param, E as Emitter } from './workspace.js';
2
- import { d as isReadableStream, e as peekStream, h as peekReadable, j as bufferToReadable, s as streamToBuffer, k as consumeStream, t as transform, l as isReadableBufferedStream, m as listenStream, n as bufferedStreamToBuffer, r as readableToBuffer, o as newWriteableBufferStream, q as newWriteableStream } from './polyfill.js';
1
+ import { _ as __decorate, a as __param, E as Emitter } from './contextkey.js';
2
+ import { j as isReadableStream, k as peekStream, l as peekReadable, m as bufferToReadable, s as streamToBuffer, o as consumeStream, t as transform, q as isReadableBufferedStream, r as listenStream, u as bufferedStreamToBuffer, v as readableToBuffer, x as newWriteableBufferStream, y as newWriteableStream } from './polyfill.js';
3
3
  import { u as unsupported } from './missing-services.js';
4
- import { bl as supportsTelemetry, bm as getTelemetryLevel, be as DEFAULT_EXTENSION, F as Disposable$1, c as CancellationTokenSource } from './extHost.js';
5
- import { c as IFileService, h as IProductService, S as Services, t as FileSystemProviderError, u as FileSystemProviderErrorCode, v as FileChangesEvent, w as FileOperationError, x as hasOpenReadWriteCloseCapability, y as hasReadWriteCapability, z as hasFileReadStreamCapability, B as toFileSystemProviderErrorCode, C as ensureFileSystemProviderError, F as FileType, a as FilePermission, D as etag, E as FileOperationEvent, G as toFileOperationResult, H as ETAG_DISABLED, J as hasFileAtomicReadCapability, N as NotModifiedSinceFileOperationError, K as hasFileFolderCopyCapability, L as hasFileCloneCapability, M as createFileSystemProviderError } from './services2.js';
4
+ import { bt as getRemoteServerRootPath, bu as supportsTelemetry, bv as getTelemetryLevel, bj as DEFAULT_EXTENSION, F as Disposable$1, c as CancellationTokenSource } from './extHost.js';
5
+ import { c as IFileService, h as IProductService, S as Services, t as createFileSystemProviderError, u as FileChangesEvent, v as FileOperationError, w as hasOpenReadWriteCloseCapability, x as hasReadWriteCapability, y as hasFileReadStreamCapability, z as toFileSystemProviderErrorCode, B as FileSystemProviderErrorCode, C as ensureFileSystemProviderError, F as FileType, a as FilePermission, D as etag, E as FileOperationEvent, G as toFileOperationResult, H as ETAG_DISABLED, J as hasFileAtomicReadCapability, N as NotModifiedSinceFileOperationError, T as TooLargeFileOperationError, K as hasFileFolderCopyCapability, L as hasFileCloneCapability, M as FileSystemProviderError } from './services2.js';
6
6
  import { VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
7
- import { canceled } from 'monaco-editor/esm/vs/base/common/errors.js';
7
+ import { canceled, ErrorNoTelemetry } from 'monaco-editor/esm/vs/base/common/errors.js';
8
8
  import { localize } from 'monaco-editor/esm/vs/nls.js';
9
9
  import { R as ResourceQueue } from './async.js';
10
10
  import { Disposable, toDisposable, dispose, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
11
11
  import { Promises } from 'monaco-editor/esm/vs/base/common/async.js';
12
12
  import { Iterable } from 'monaco-editor/esm/vs/base/common/iterator.js';
13
13
  import { basename, dirname, isAbsolutePath, extUri, extUriIgnorePathCase } from 'monaco-editor/esm/vs/base/common/resources.js';
14
- import { TernarySearchTree } from 'monaco-editor/esm/vs/base/common/map.js';
14
+ import { TernarySearchTree } from 'monaco-editor/esm/vs/base/common/ternarySearchTree.js';
15
15
  import { coalesce } from 'monaco-editor/esm/vs/base/common/arrays.js';
16
16
  import { hash } from 'monaco-editor/esm/vs/base/common/hash.js';
17
17
  import { CancellationToken } from 'monaco-editor/esm/vs/base/common/cancellation.js';
18
18
  import { RemoteAuthorities, Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
19
19
  import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
20
- import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
21
20
  import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
22
21
  import { Lazy } from 'monaco-editor/esm/vs/base/common/lazy.js';
23
22
  import { LRUCachedFunction } from 'monaco-editor/esm/vs/base/common/cache.js';
@@ -29,20 +28,21 @@ import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/comm
29
28
  import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
30
29
  import { IEnvironmentService } from 'monaco-editor/esm/vs/platform/environment/common/environment.js';
31
30
  import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
31
+ import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
32
32
  var _a;
33
33
  const _format2Regexp = /{([^}]+)}/g;
34
34
  function format2(template, values) {
35
35
  return template.replace(_format2Regexp, (match, group) => (values[group] ?? match));
36
36
  }
37
37
  class AmbiguousCharacters {
38
- constructor(confusableDictionary) {
39
- this.confusableDictionary = confusableDictionary;
40
- }
41
38
  static getInstance(locales) {
42
39
  return AmbiguousCharacters.cache.get(Array.from(locales));
43
40
  }
44
41
  static getLocales() {
45
- return AmbiguousCharacters._locales.getValue();
42
+ return AmbiguousCharacters._locales.value;
43
+ }
44
+ constructor(confusableDictionary) {
45
+ this.confusableDictionary = confusableDictionary;
46
46
  }
47
47
  isAmbiguous(codePoint) {
48
48
  return this.confusableDictionary.has(codePoint);
@@ -87,7 +87,7 @@ AmbiguousCharacters.cache = ( (new LRUCachedFunction((locales) => {
87
87
  }
88
88
  return result;
89
89
  }
90
- const data = _a.ambiguousCharacterData.getValue();
90
+ const data = _a.ambiguousCharacterData.value;
91
91
  let filteredLocales = locales.filter((l) => !l.startsWith('_') && l in data);
92
92
  if (filteredLocales.length === 0) {
93
93
  filteredLocales = ['_default'];
@@ -104,18 +104,12 @@ AmbiguousCharacters.cache = ( (new LRUCachedFunction((locales) => {
104
104
  );
105
105
  })));
106
106
  AmbiguousCharacters._locales = ( (new Lazy(
107
- () => ( (Object.keys(AmbiguousCharacters.ambiguousCharacterData.getValue()))).filter((k) => !k.startsWith('_'))
107
+ () => ( (Object.keys(AmbiguousCharacters.ambiguousCharacterData.value))).filter((k) => !k.startsWith('_'))
108
108
  )));
109
109
  const _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
110
110
  function isUUID(value) {
111
111
  return _UUIDPattern.test(value);
112
112
  }
113
- function getRemoteAuthority(uri) {
114
- return uri.scheme === Schemas.vscodeRemote ? uri.authority : undefined;
115
- }
116
- function getRemoteServerRootPath(product) {
117
- return `/${product.quality ?? 'oss'}-${product.commit ?? 'dev'}`;
118
- }
119
113
  async function getServiceMachineId(environmentService, fileService, storageService) {
120
114
  let uuid = storageService ? storageService.get('storage.serviceMachineId', -1 ) || null : null;
121
115
  if (uuid) {
@@ -222,14 +216,23 @@ class Directory {
222
216
  class InMemoryFileSystemProvider extends Disposable {
223
217
  constructor() {
224
218
  super(...arguments);
225
- this.capabilities = 2
226
- | 1024 ;
227
- this.onDidChangeCapabilities = Event.None;
219
+ this._onDidChangeCapabilities = this._register(( (new Emitter())));
220
+ this.onDidChangeCapabilities = this._onDidChangeCapabilities.event;
221
+ this._capabilities = 2 | 1024 ;
228
222
  this.root = ( (new Directory('')));
229
223
  this._onDidChangeFile = this._register(( (new Emitter())));
230
224
  this.onDidChangeFile = this._onDidChangeFile.event;
231
225
  this._bufferedChanges = [];
232
226
  }
227
+ get capabilities() { return this._capabilities; }
228
+ setReadOnly(readonly) {
229
+ const isReadonly = !!((this._capabilities & 2048) );
230
+ if (readonly !== isReadonly) {
231
+ this._capabilities = readonly ? 2048 | 1024 | 2
232
+ : 2 | 1024 ;
233
+ this._onDidChangeCapabilities.fire();
234
+ }
235
+ }
233
236
  async stat(resource) {
234
237
  return this._lookup(resource, false);
235
238
  }
@@ -244,20 +247,20 @@ class InMemoryFileSystemProvider extends Disposable {
244
247
  if (data) {
245
248
  return data;
246
249
  }
247
- throw new FileSystemProviderError('file not found', FileSystemProviderErrorCode.FileNotFound);
250
+ throw createFileSystemProviderError('file not found', FileSystemProviderErrorCode.FileNotFound);
248
251
  }
249
252
  async writeFile(resource, content, opts) {
250
253
  const basename$1 = basename(resource);
251
254
  const parent = this._lookupParentDirectory(resource);
252
255
  let entry = parent.entries.get(basename$1);
253
256
  if (entry instanceof Directory) {
254
- throw new FileSystemProviderError('file is directory', FileSystemProviderErrorCode.FileIsADirectory);
257
+ throw createFileSystemProviderError('file is directory', FileSystemProviderErrorCode.FileIsADirectory);
255
258
  }
256
259
  if (!entry && !opts.create) {
257
- throw new FileSystemProviderError('file not found', FileSystemProviderErrorCode.FileNotFound);
260
+ throw createFileSystemProviderError('file not found', FileSystemProviderErrorCode.FileNotFound);
258
261
  }
259
262
  if (entry && opts.create && !opts.overwrite) {
260
- throw new FileSystemProviderError('file exists already', FileSystemProviderErrorCode.FileExists);
263
+ throw createFileSystemProviderError('file exists already', FileSystemProviderErrorCode.FileExists);
261
264
  }
262
265
  if (!entry) {
263
266
  entry = ( (new File$1(basename$1)));
@@ -271,7 +274,7 @@ class InMemoryFileSystemProvider extends Disposable {
271
274
  }
272
275
  async rename(from, to, opts) {
273
276
  if (!opts.overwrite && this._lookup(to, true)) {
274
- throw new FileSystemProviderError('file exists already', FileSystemProviderErrorCode.FileExists);
277
+ throw createFileSystemProviderError('file exists already', FileSystemProviderErrorCode.FileExists);
275
278
  }
276
279
  const entry = this._lookup(from, false);
277
280
  const oldParent = this._lookupParentDirectory(from);
@@ -295,7 +298,7 @@ class InMemoryFileSystemProvider extends Disposable {
295
298
  }
296
299
  async mkdir(resource) {
297
300
  if (this._lookup(resource, true)) {
298
- throw new FileSystemProviderError('file exists already', FileSystemProviderErrorCode.FileExists);
301
+ throw createFileSystemProviderError('file exists already', FileSystemProviderErrorCode.FileExists);
299
302
  }
300
303
  const basename$1 = basename(resource);
301
304
  const dirname$1 = dirname(resource);
@@ -319,7 +322,7 @@ class InMemoryFileSystemProvider extends Disposable {
319
322
  }
320
323
  if (!child) {
321
324
  if (!silent) {
322
- throw new FileSystemProviderError('file not found', FileSystemProviderErrorCode.FileNotFound);
325
+ throw createFileSystemProviderError('file not found', FileSystemProviderErrorCode.FileNotFound);
323
326
  }
324
327
  else {
325
328
  return undefined;
@@ -334,14 +337,14 @@ class InMemoryFileSystemProvider extends Disposable {
334
337
  if (entry instanceof Directory) {
335
338
  return entry;
336
339
  }
337
- throw new FileSystemProviderError('file not a directory', FileSystemProviderErrorCode.FileNotADirectory);
340
+ throw createFileSystemProviderError('file not a directory', FileSystemProviderErrorCode.FileNotADirectory);
338
341
  }
339
342
  _lookupAsFile(uri, silent) {
340
343
  const entry = this._lookup(uri, silent);
341
344
  if (entry instanceof File$1) {
342
345
  return entry;
343
346
  }
344
- throw new FileSystemProviderError('file is a directory', FileSystemProviderErrorCode.FileIsADirectory);
347
+ throw createFileSystemProviderError('file is a directory', FileSystemProviderErrorCode.FileIsADirectory);
345
348
  }
346
349
  _lookupParentDirectory(uri) {
347
350
  const dirname$1 = dirname(uri);
@@ -512,11 +515,10 @@ let FileService = class FileService extends Disposable {
512
515
  await this.activateProvider(resource.scheme);
513
516
  const provider = this.provider.get(resource.scheme);
514
517
  if (!provider) {
515
- const error = ( (new Error()));
516
- error.name = 'ENOPRO';
518
+ const error = ( (new ErrorNoTelemetry()));
517
519
  error.message = ( (localize(
518
520
  'noProviderFound',
519
- "No file system provider found for resource '{0}'",
521
+ "ENOPRO: No file system provider found for resource '{0}'",
520
522
  (resource.toString())
521
523
  )));
522
524
  throw error;
@@ -789,30 +791,35 @@ let FileService = class FileService extends Disposable {
789
791
  if (fileStream) {
790
792
  await consumeStream(fileStream);
791
793
  }
792
- const message = ( (localize(
793
- 'err.read',
794
- "Unable to read file '{0}' ({1})",
795
- this.resourceForError(resource),
796
- (ensureFileSystemProviderError(error).toString())
797
- )));
798
- if (error instanceof NotModifiedSinceFileOperationError) {
799
- throw new NotModifiedSinceFileOperationError(message, error.stat, options);
800
- }
801
- else {
802
- throw new FileOperationError(message, toFileOperationResult(error), options);
803
- }
794
+ throw this.restoreReadError(error, resource, options);
795
+ }
796
+ }
797
+ restoreReadError(error, resource, options) {
798
+ const message = ( (localize(
799
+ 'err.read',
800
+ "Unable to read file '{0}' ({1})",
801
+ this.resourceForError(resource),
802
+ (ensureFileSystemProviderError(error).toString())
803
+ )));
804
+ if (error instanceof NotModifiedSinceFileOperationError) {
805
+ return (
806
+ (new NotModifiedSinceFileOperationError(message, error.stat, options))
807
+ );
808
+ }
809
+ if (error instanceof TooLargeFileOperationError) {
810
+ return (
811
+ (new TooLargeFileOperationError(message, error.fileOperationResult, error.size, error.options))
812
+ );
804
813
  }
814
+ return (
815
+ (new FileOperationError(message, toFileOperationResult(error), options))
816
+ );
805
817
  }
806
818
  readFileStreamed(provider, resource, token, options = Object.create(null)) {
807
819
  const fileStream = provider.readFileStream(resource, options, token);
808
820
  return transform(fileStream, {
809
821
  data: data => data instanceof VSBuffer ? data : VSBuffer.wrap(data),
810
- error: error => ( (new FileOperationError( (localize(
811
- 'err.read',
812
- "Unable to read file '{0}' ({1})",
813
- this.resourceForError(resource),
814
- (ensureFileSystemProviderError(error).toString())
815
- )), toFileOperationResult(error), options)))
822
+ error: error => this.restoreReadError(error, resource, options)
816
823
  }, data => VSBuffer.concat(data));
817
824
  }
818
825
  readFileBuffered(provider, resource, token, options = Object.create(null)) {
@@ -820,12 +827,7 @@ let FileService = class FileService extends Disposable {
820
827
  readFileIntoStream(provider, resource, stream, data => data, {
821
828
  ...options,
822
829
  bufferSize: this.BUFFER_SIZE,
823
- errorTransformer: error => ( (new FileOperationError( (localize(
824
- 'err.read',
825
- "Unable to read file '{0}' ({1})",
826
- this.resourceForError(resource),
827
- (ensureFileSystemProviderError(error).toString())
828
- )), toFileOperationResult(error), options)))
830
+ errorTransformer: error => this.restoreReadError(error, resource, options)
829
831
  }, token);
830
832
  return stream;
831
833
  }
@@ -877,7 +879,7 @@ let FileService = class FileService extends Disposable {
877
879
  tooLargeErrorResult = 7 ;
878
880
  }
879
881
  if (typeof tooLargeErrorResult === 'number') {
880
- throw new FileOperationError(localize('fileTooLargeError', "Unable to read file '{0}' that is too large to open", this.resourceForError(resource)), tooLargeErrorResult);
882
+ throw new TooLargeFileOperationError(localize('fileTooLargeError', "Unable to read file '{0}' that is too large to open", this.resourceForError(resource)), tooLargeErrorResult, size, options);
881
883
  }
882
884
  }
883
885
  }
@@ -1361,7 +1363,7 @@ SimpleExtensionResourceLoaderService = ( __decorate([
1361
1363
  ( __param(3, IEnvironmentService)),
1362
1364
  ( __param(4, IConfigurationService))
1363
1365
  ], SimpleExtensionResourceLoaderService));
1364
- registerSingleton(IExtensionResourceLoaderService, SimpleExtensionResourceLoaderService);
1366
+ registerSingleton(IExtensionResourceLoaderService, SimpleExtensionResourceLoaderService, 0 );
1365
1367
  class File {
1366
1368
  constructor(getContent) {
1367
1369
  this.getContent = getContent;
@@ -1390,14 +1392,14 @@ class ExtensionFileSystemProviderWithFileReadWriteCapability {
1390
1392
  if (file != null) {
1391
1393
  return file;
1392
1394
  }
1393
- throw new FileSystemProviderError('file not found', FileSystemProviderErrorCode.FileNotFound);
1395
+ throw FileSystemProviderError.create('file not found', FileSystemProviderErrorCode.FileNotFound);
1394
1396
  }
1395
1397
  async readFile(resource) {
1396
1398
  const file = this.files.get(( resource.toString()));
1397
1399
  if (file != null) {
1398
1400
  return encoder.encode(await file.getContent());
1399
1401
  }
1400
- throw new FileSystemProviderError('file not found', FileSystemProviderErrorCode.FileNotFound);
1402
+ throw FileSystemProviderError.create('file not found', FileSystemProviderErrorCode.FileNotFound);
1401
1403
  }
1402
1404
  watch() {
1403
1405
  return {
@@ -1432,4 +1434,4 @@ function getServiceOverride() {
1432
1434
  [( IExtensionResourceLoaderService.toString())]: new SyncDescriptor(SimpleExtensionResourceLoaderService)
1433
1435
  };
1434
1436
  }
1435
- export { IExtensionResourceLoaderService as I, getRemoteAuthority as a, getServiceOverride as g, registerExtensionFile as r };
1437
+ export { IExtensionResourceLoaderService as I, getServiceOverride as g, registerExtensionFile as r };
@@ -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
  interface IUserFriendlyKeybinding {
458
475
  key: string;
@@ -463,17 +480,6 @@ interface IUserFriendlyKeybinding {
463
480
 
464
481
  type IEditorOverrideServices = monaco.editor.IEditorOverrideServices
465
482
 
466
- interface ILocalizedString {
467
- /**
468
- * The localized value of the string.
469
- */
470
- value: string;
471
- /**
472
- * The original (non localized value of the string)
473
- */
474
- original: string;
475
- }
476
-
477
483
  interface ContributedKeyBinding {
478
484
  command: string;
479
485
  args?: any;