@codingame/monaco-vscode-api 1.79.11 → 1.79.13

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/editor.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { E as Event, b as Emitter, a as IDisposable, D as Disposable } from './event.js';
1
+ import { E as Event, c as Emitter, C as CancellationToken, a as IDisposable, d as IWaitUntil, D as Disposable } from './event.js';
2
2
  import { U as URI } from './uri.js';
3
- import { k as IMarkdownString, d as IEditorOptions, l as IEditorModel, m as IDimension, j as IComposite, i as IDiffEditor, n as ICompositeControl, o as IBaseTextResourceEditorInput, p as IBaseUntypedEditorInput, e as IResourceEditorInput, f as ITextResourceEditorInput } from './editorBrowser.js';
3
+ import { m as IMarkdownString, d as IEditorOptions, v as IEditorModel, w as IDimension, x as ITextEditorModel, y as IProgress, z as IProgressStep, A as ITextSnapshot, B as ITextBufferFactory, j as ITextModel, s as IComposite, i as IDiffEditor, C as ICompositeControl, D as IBaseTextResourceEditorInput, F as IBaseUntypedEditorInput, e as IResourceEditorInput, f as ITextResourceEditorInput } from './editorBrowser.js';
4
4
  import { S as ServiceIdentifier, I as IInstantiationService } from './instantiation.js';
5
5
  import { a as IContextKeyService } from './contextkey.js';
6
+ import { o as VSBufferReadable, p as VSBufferReadableStream, q as IFileStatWithMetadata, r as FileOperation, V as VSBuffer, s as ReadableStream, t as IReadFileStreamOptions, u as IWriteFileOptions, v as IBaseFileStatWithMetadata, w as IFileReadLimits } from './files.js';
6
7
  import { T as ThemeIcon } from './themables.js';
7
8
  import { S as Severity } from './severity.js';
8
9
 
@@ -420,6 +421,161 @@ declare abstract class EditorInput extends AbstractEditorInput {
420
421
  dispose(): void;
421
422
  }
422
423
 
424
+ declare const enum WorkingCopyCapabilities {
425
+ /**
426
+ * Signals no specific capability for the working copy.
427
+ */
428
+ None = 0,
429
+ /**
430
+ * Signals that the working copy requires
431
+ * additional input when saving, e.g. an
432
+ * associated path to save to.
433
+ */
434
+ Untitled = 2,
435
+ /**
436
+ * The working copy will not indicate that
437
+ * it is dirty and unsaved content will be
438
+ * discarded without prompting if closed.
439
+ */
440
+ Scratchpad = 4
441
+ }
442
+ /**
443
+ * Data to be associated with working copy backups. Use
444
+ * `IWorkingCopyBackupService.resolve(workingCopy)` to
445
+ * retrieve the backup when loading the working copy.
446
+ */
447
+ interface IWorkingCopyBackup {
448
+ /**
449
+ * Any serializable metadata to be associated with the backup.
450
+ */
451
+ meta?: IWorkingCopyBackupMeta;
452
+ /**
453
+ * The actual snapshot of the contents of the working copy at
454
+ * the time the backup was made.
455
+ */
456
+ content?: VSBufferReadable | VSBufferReadableStream;
457
+ }
458
+ /**
459
+ * Working copy backup metadata that can be associated
460
+ * with the backup.
461
+ *
462
+ * Some properties may be reserved as outlined here and
463
+ * cannot be used.
464
+ */
465
+ interface IWorkingCopyBackupMeta {
466
+ /**
467
+ * Any property needs to be serializable through JSON.
468
+ */
469
+ [key: string]: unknown;
470
+ /**
471
+ * `typeId` is a reserved property that cannot be used
472
+ * as backup metadata.
473
+ */
474
+ typeId?: never;
475
+ }
476
+ /**
477
+ * Every working copy has in common that it is identified by
478
+ * a resource `URI` and a `typeId`. There can only be one
479
+ * working copy registered with the same `URI` and `typeId`.
480
+ */
481
+ interface IWorkingCopyIdentifier {
482
+ /**
483
+ * The type identifier of the working copy for grouping
484
+ * working copies of the same domain together.
485
+ *
486
+ * There can only be one working copy for a given resource
487
+ * and type identifier.
488
+ */
489
+ readonly typeId: string;
490
+ /**
491
+ * The resource of the working copy must be unique for
492
+ * working copies of the same `typeId`.
493
+ */
494
+ readonly resource: URI;
495
+ }
496
+ interface IWorkingCopySaveEvent {
497
+ /**
498
+ * The reason why the working copy was saved.
499
+ */
500
+ readonly reason?: SaveReason;
501
+ /**
502
+ * The source of the working copy save request.
503
+ */
504
+ readonly source?: SaveSource;
505
+ }
506
+ /**
507
+ * A working copy is an abstract concept to unify handling of
508
+ * data that can be worked on (e.g. edited) in an editor.
509
+ *
510
+ *
511
+ * A working copy resource may be the backing store of the data
512
+ * (e.g. a file on disk), but that is not a requirement. If
513
+ * your working copy is file based, consider to use the
514
+ * `IFileWorkingCopy` instead that simplifies a lot of things
515
+ * when working with file based working copies.
516
+ */
517
+ interface IWorkingCopy extends IWorkingCopyIdentifier {
518
+ /**
519
+ * Human readable name of the working copy.
520
+ */
521
+ readonly name: string;
522
+ /**
523
+ * The capabilities of the working copy.
524
+ */
525
+ readonly capabilities: WorkingCopyCapabilities;
526
+ /**
527
+ * Used by the workbench to signal if the working copy
528
+ * is dirty or not. Typically a working copy is dirty
529
+ * once changed until saved or reverted.
530
+ */
531
+ readonly onDidChangeDirty: Event<void>;
532
+ /**
533
+ * Used by the workbench e.g. to trigger auto-save
534
+ * (unless this working copy is untitled) and backups.
535
+ */
536
+ readonly onDidChangeContent: Event<void>;
537
+ /**
538
+ * Used by the workbench e.g. to track local history
539
+ * (unless this working copy is untitled).
540
+ */
541
+ readonly onDidSave: Event<IWorkingCopySaveEvent>;
542
+ /**
543
+ * Indicates that the file has unsaved changes
544
+ * and should confirm before closing.
545
+ */
546
+ isDirty(): boolean;
547
+ /**
548
+ * Indicates that the file has unsaved changes.
549
+ * Used for backup tracking and accounts for
550
+ * working copies that are never dirty e.g.
551
+ * scratchpads.
552
+ */
553
+ isModified(): boolean;
554
+ /**
555
+ * The workbench may call this method often after it receives
556
+ * the `onDidChangeContent` event for the working copy. The motivation
557
+ * is to allow to quit VSCode with dirty working copies present.
558
+ *
559
+ * Providers of working copies should use `IWorkingCopyBackupService.resolve(workingCopy)`
560
+ * to retrieve the backup metadata associated when loading the working copy.
561
+ *
562
+ * @param token support for cancellation
563
+ */
564
+ backup(token: CancellationToken): Promise<IWorkingCopyBackup>;
565
+ /**
566
+ * Asks the working copy to save. If the working copy was dirty, it is
567
+ * expected to be non-dirty after this operation has finished.
568
+ *
569
+ * @returns `true` if the operation was successful and `false` otherwise.
570
+ */
571
+ save(options?: ISaveOptions): Promise<boolean>;
572
+ /**
573
+ * Asks the working copy to revert. If the working copy was dirty, it is
574
+ * expected to be non-dirty after this operation has finished.
575
+ */
576
+ revert(options?: IRevertOptions): Promise<void>;
577
+ }
578
+
423
579
  interface IGroupModelChangeEvent {
424
580
  /**
425
581
  * The kind of change that occurred in the group model.
@@ -1038,6 +1194,947 @@ interface IEditorGroup {
1038
1194
  focus(): void;
1039
1195
  }
1040
1196
 
1197
+ interface IUntitledTextEditorModel extends ITextEditorModel, ILanguageSupport, IEncodingSupport, IWorkingCopy {
1198
+ /**
1199
+ * Emits an event when the encoding of this untitled model changes.
1200
+ */
1201
+ readonly onDidChangeEncoding: Event<void>;
1202
+ /**
1203
+ * Emits an event when the name of this untitled model changes.
1204
+ */
1205
+ readonly onDidChangeName: Event<void>;
1206
+ /**
1207
+ * Emits an event when this untitled model is reverted.
1208
+ */
1209
+ readonly onDidRevert: Event<void>;
1210
+ /**
1211
+ * Whether this untitled text model has an associated file path.
1212
+ */
1213
+ readonly hasAssociatedFilePath: boolean;
1214
+ /**
1215
+ * Whether this model has an explicit language or not.
1216
+ */
1217
+ readonly hasLanguageSetExplicitly: boolean;
1218
+ /**
1219
+ * Sets the encoding to use for this untitled model.
1220
+ */
1221
+ setEncoding(encoding: string): Promise<void>;
1222
+ /**
1223
+ * Resolves the untitled model.
1224
+ */
1225
+ resolve(): Promise<void>;
1226
+ }
1227
+
1228
+ interface INewUntitledTextEditorOptions {
1229
+ /**
1230
+ * Initial value of the untitled editor. An untitled editor with initial
1231
+ * value is dirty right from the beginning.
1232
+ */
1233
+ initialValue?: string;
1234
+ /**
1235
+ * Preferred language id to use when saving the untitled editor.
1236
+ */
1237
+ languageId?: string;
1238
+ /**
1239
+ * Preferred encoding to use when saving the untitled editor.
1240
+ */
1241
+ encoding?: string;
1242
+ }
1243
+ interface IExistingUntitledTextEditorOptions extends INewUntitledTextEditorOptions {
1244
+ /**
1245
+ * A resource to identify the untitled editor to create or return
1246
+ * if already existing.
1247
+ *
1248
+ * Note: the resource will not be used unless the scheme is `untitled`.
1249
+ */
1250
+ untitledResource?: URI;
1251
+ }
1252
+ interface INewUntitledTextEditorWithAssociatedResourceOptions extends INewUntitledTextEditorOptions {
1253
+ /**
1254
+ * Resource components to associate with the untitled editor. When saving
1255
+ * the untitled editor, the associated components will be used and the user
1256
+ * is not being asked to provide a file path.
1257
+ *
1258
+ * Note: currently it is not possible to specify the `scheme` to use. The
1259
+ * untitled editor will saved to the default local or remote resource.
1260
+ */
1261
+ associatedResource?: {
1262
+ authority: string;
1263
+ path: string;
1264
+ query: string;
1265
+ fragment: string;
1266
+ };
1267
+ }
1268
+ interface IUntitledTextEditorModelManager {
1269
+ /**
1270
+ * Events for when untitled text editors change (e.g. getting dirty, saved or reverted).
1271
+ */
1272
+ readonly onDidChangeDirty: Event<IUntitledTextEditorModel>;
1273
+ /**
1274
+ * Events for when untitled text editor encodings change.
1275
+ */
1276
+ readonly onDidChangeEncoding: Event<IUntitledTextEditorModel>;
1277
+ /**
1278
+ * Events for when untitled text editor labels change.
1279
+ */
1280
+ readonly onDidChangeLabel: Event<IUntitledTextEditorModel>;
1281
+ /**
1282
+ * Events for when untitled text editors are about to be disposed.
1283
+ */
1284
+ readonly onWillDispose: Event<IUntitledTextEditorModel>;
1285
+ /**
1286
+ * Creates a new untitled editor model with the provided options. If the `untitledResource`
1287
+ * property is provided and the untitled editor exists, it will return that existing
1288
+ * instance instead of creating a new one.
1289
+ */
1290
+ create(options?: INewUntitledTextEditorOptions): IUntitledTextEditorModel;
1291
+ create(options?: INewUntitledTextEditorWithAssociatedResourceOptions): IUntitledTextEditorModel;
1292
+ create(options?: IExistingUntitledTextEditorOptions): IUntitledTextEditorModel;
1293
+ /**
1294
+ * Returns an existing untitled editor model if already created before.
1295
+ */
1296
+ get(resource: URI): IUntitledTextEditorModel | undefined;
1297
+ /**
1298
+ * Returns the value of the untitled editor, undefined if none exists
1299
+ * @param resource The URI of the untitled file
1300
+ * @returns The content, or undefined
1301
+ */
1302
+ getValue(resource: URI): string | undefined;
1303
+ /**
1304
+ * Resolves an untitled editor model from the provided options. If the `untitledResource`
1305
+ * property is provided and the untitled editor exists, it will return that existing
1306
+ * instance instead of creating a new one.
1307
+ */
1308
+ resolve(options?: INewUntitledTextEditorOptions): Promise<IUntitledTextEditorModel>;
1309
+ resolve(options?: INewUntitledTextEditorWithAssociatedResourceOptions): Promise<IUntitledTextEditorModel>;
1310
+ resolve(options?: IExistingUntitledTextEditorOptions): Promise<IUntitledTextEditorModel>;
1311
+ /**
1312
+ * Figures out if the given resource has an associated resource or not.
1313
+ */
1314
+ isUntitledWithAssociatedResource(resource: URI): boolean;
1315
+ }
1316
+
1317
+ /**
1318
+ * A resource based `IWorkingCopy` is backed by a `URI` from a
1319
+ * known file system provider.
1320
+ */
1321
+ interface IResourceWorkingCopy extends IWorkingCopy, IDisposable {
1322
+ /**
1323
+ * An event for when the orphaned state of the resource working copy changes.
1324
+ */
1325
+ readonly onDidChangeOrphaned: Event<void>;
1326
+ /**
1327
+ * Whether the resource working copy is orphaned or not.
1328
+ */
1329
+ isOrphaned(): boolean;
1330
+ /**
1331
+ * An event for when the file working copy has been disposed.
1332
+ */
1333
+ readonly onWillDispose: Event<void>;
1334
+ /**
1335
+ * Whether the file working copy has been disposed or not.
1336
+ */
1337
+ isDisposed(): boolean;
1338
+ }
1339
+
1340
+ /**
1341
+ * A generic file working copy model to be reused by untitled
1342
+ * and stored file working copies.
1343
+ */
1344
+ interface IFileWorkingCopyModel extends IDisposable {
1345
+ /**
1346
+ * This event signals ANY changes to the contents, for example:
1347
+ * - through the user typing into the editor
1348
+ * - from API usage (e.g. bulk edits)
1349
+ * - when `IFileWorkingCopyModel#update` is invoked with contents
1350
+ * that are different from the current contents
1351
+ *
1352
+ * The file working copy will listen to these changes and may mark
1353
+ * the working copy as dirty whenever this event fires.
1354
+ *
1355
+ * Note: ONLY report changes to the model but not the underlying
1356
+ * file. The file working copy is tracking changes to the file
1357
+ * automatically.
1358
+ */
1359
+ readonly onDidChangeContent: Event<unknown>;
1360
+ /**
1361
+ * An event emitted right before disposing the model.
1362
+ */
1363
+ readonly onWillDispose: Event<void>;
1364
+ /**
1365
+ * Snapshots the model's current content for writing. This must include
1366
+ * any changes that were made to the model that are in memory.
1367
+ *
1368
+ * @param token support for cancellation
1369
+ */
1370
+ snapshot(token: CancellationToken): Promise<VSBufferReadableStream>;
1371
+ /**
1372
+ * Updates the model with the provided contents. The implementation should
1373
+ * behave in a similar fashion as `IFileWorkingCopyModelFactory#createModel`
1374
+ * except that here the model already exists and just needs to update to
1375
+ * the provided contents.
1376
+ *
1377
+ * Note: it is expected that the model fires a `onDidChangeContent` event
1378
+ * as part of the update.
1379
+ *
1380
+ * @param contents the contents to use for the model
1381
+ * @param token support for cancellation
1382
+ */
1383
+ update(contents: VSBufferReadableStream, token: CancellationToken): Promise<void>;
1384
+ }
1385
+ interface IFileWorkingCopy<M extends IFileWorkingCopyModel> extends IWorkingCopy, IDisposable {
1386
+ /**
1387
+ * An event for when the file working copy has been reverted.
1388
+ */
1389
+ readonly onDidRevert: Event<void>;
1390
+ /**
1391
+ * An event for when the file working copy has been disposed.
1392
+ */
1393
+ readonly onWillDispose: Event<void>;
1394
+ /**
1395
+ * Provides access to the underlying model of this file
1396
+ * based working copy. As long as the file working copy
1397
+ * has not been resolved, the model is `undefined`.
1398
+ */
1399
+ readonly model: M | undefined;
1400
+ /**
1401
+ * Resolves the file working copy and thus makes the `model`
1402
+ * available.
1403
+ */
1404
+ resolve(): Promise<void>;
1405
+ /**
1406
+ * Whether we have a resolved model or not.
1407
+ */
1408
+ isResolved(): this is IResolvedFileWorkingCopy<M>;
1409
+ }
1410
+ interface IResolvedFileWorkingCopy<M extends IFileWorkingCopyModel> extends IFileWorkingCopy<M> {
1411
+ /**
1412
+ * A resolved file working copy has a resolved model.
1413
+ */
1414
+ readonly model: M;
1415
+ }
1416
+
1417
+ /**
1418
+ * The underlying model of a stored file working copy provides some
1419
+ * methods for the stored file working copy to function. The model is
1420
+ * typically only available after the working copy has been
1421
+ * resolved via it's `resolve()` method.
1422
+ */
1423
+ interface IStoredFileWorkingCopyModel extends IFileWorkingCopyModel {
1424
+ readonly onDidChangeContent: Event<IStoredFileWorkingCopyModelContentChangedEvent>;
1425
+ /**
1426
+ * A version ID of the model. If a `onDidChangeContent` is fired
1427
+ * from the model and the last known saved `versionId` matches
1428
+ * with the `model.versionId`, the stored file working copy will
1429
+ * discard any dirty state.
1430
+ *
1431
+ * A use case is the following:
1432
+ * - a stored file working copy gets edited and thus dirty
1433
+ * - the user triggers undo to revert the changes
1434
+ * - at this point the `versionId` should match the one we had saved
1435
+ *
1436
+ * This requires the model to be aware of undo/redo operations.
1437
+ */
1438
+ readonly versionId: unknown;
1439
+ /**
1440
+ * Close the current undo-redo element. This offers a way
1441
+ * to create an undo/redo stop point.
1442
+ *
1443
+ * This method may for example be called right before the
1444
+ * save is triggered so that the user can always undo back
1445
+ * to the state before saving.
1446
+ */
1447
+ pushStackElement(): void;
1448
+ }
1449
+ interface IStoredFileWorkingCopyModelContentChangedEvent {
1450
+ /**
1451
+ * Flag that indicates that this event was generated while undoing.
1452
+ */
1453
+ readonly isUndoing: boolean;
1454
+ /**
1455
+ * Flag that indicates that this event was generated while redoing.
1456
+ */
1457
+ readonly isRedoing: boolean;
1458
+ }
1459
+ /**
1460
+ * A stored file based `IWorkingCopy` is backed by a `URI` from a
1461
+ * known file system provider. Given this assumption, a lot
1462
+ * of functionality can be built on top, such as saving in
1463
+ * a secure way to prevent data loss.
1464
+ */
1465
+ interface IStoredFileWorkingCopy<M extends IStoredFileWorkingCopyModel> extends IResourceWorkingCopy, IFileWorkingCopy<M> {
1466
+ /**
1467
+ * An event for when a stored file working copy was resolved.
1468
+ */
1469
+ readonly onDidResolve: Event<void>;
1470
+ /**
1471
+ * An event for when a stored file working copy was saved successfully.
1472
+ */
1473
+ readonly onDidSave: Event<IStoredFileWorkingCopySaveEvent>;
1474
+ /**
1475
+ * An event indicating that a stored file working copy save operation failed.
1476
+ */
1477
+ readonly onDidSaveError: Event<void>;
1478
+ /**
1479
+ * An event for when the readonly state of the stored file working copy changes.
1480
+ */
1481
+ readonly onDidChangeReadonly: Event<void>;
1482
+ /**
1483
+ * Resolves a stored file working copy.
1484
+ */
1485
+ resolve(options?: IStoredFileWorkingCopyResolveOptions): Promise<void>;
1486
+ /**
1487
+ * Explicitly sets the working copy to be modified.
1488
+ */
1489
+ markModified(): void;
1490
+ /**
1491
+ * Whether the stored file working copy is in the provided `state`
1492
+ * or not.
1493
+ *
1494
+ * @param state the `FileWorkingCopyState` to check on.
1495
+ */
1496
+ hasState(state: StoredFileWorkingCopyState): boolean;
1497
+ /**
1498
+ * Allows to join a state change away from the provided `state`.
1499
+ *
1500
+ * @param state currently only `FileWorkingCopyState.PENDING_SAVE`
1501
+ * can be awaited on to resolve.
1502
+ */
1503
+ joinState(state: StoredFileWorkingCopyState.PENDING_SAVE): Promise<void>;
1504
+ /**
1505
+ * Whether we have a resolved model or not.
1506
+ */
1507
+ isResolved(): this is IResolvedStoredFileWorkingCopy<M>;
1508
+ /**
1509
+ * Whether the stored file working copy is readonly or not.
1510
+ */
1511
+ isReadonly(): boolean;
1512
+ }
1513
+ interface IResolvedStoredFileWorkingCopy<M extends IStoredFileWorkingCopyModel> extends IStoredFileWorkingCopy<M> {
1514
+ /**
1515
+ * A resolved stored file working copy has a resolved model.
1516
+ */
1517
+ readonly model: M;
1518
+ }
1519
+ /**
1520
+ * States the stored file working copy can be in.
1521
+ */
1522
+ declare const enum StoredFileWorkingCopyState {
1523
+ /**
1524
+ * A stored file working copy is saved.
1525
+ */
1526
+ SAVED = 0,
1527
+ /**
1528
+ * A stored file working copy is dirty.
1529
+ */
1530
+ DIRTY = 1,
1531
+ /**
1532
+ * A stored file working copy is currently being saved but
1533
+ * this operation has not completed yet.
1534
+ */
1535
+ PENDING_SAVE = 2,
1536
+ /**
1537
+ * A stored file working copy is in conflict mode when changes
1538
+ * cannot be saved because the underlying file has changed.
1539
+ * Stored file working copies in conflict mode are always dirty.
1540
+ */
1541
+ CONFLICT = 3,
1542
+ /**
1543
+ * A stored file working copy is in orphan state when the underlying
1544
+ * file has been deleted.
1545
+ */
1546
+ ORPHAN = 4,
1547
+ /**
1548
+ * Any error that happens during a save that is not causing
1549
+ * the `StoredFileWorkingCopyState.CONFLICT` state.
1550
+ * Stored file working copies in error mode are always dirty.
1551
+ */
1552
+ ERROR = 5
1553
+ }
1554
+ interface IStoredFileWorkingCopyResolveOptions {
1555
+ /**
1556
+ * The contents to use for the stored file working copy if known. If not
1557
+ * provided, the contents will be retrieved from the underlying
1558
+ * resource or backup if present.
1559
+ *
1560
+ * If contents are provided, the stored file working copy will be marked
1561
+ * as dirty right from the beginning.
1562
+ */
1563
+ readonly contents?: VSBufferReadableStream;
1564
+ /**
1565
+ * Go to disk bypassing any cache of the stored file working copy if any.
1566
+ */
1567
+ readonly forceReadFromFile?: boolean;
1568
+ }
1569
+ interface IStoredFileWorkingCopySaveEvent extends IWorkingCopySaveEvent {
1570
+ /**
1571
+ * The resolved stat from the save operation.
1572
+ */
1573
+ readonly stat: IFileStatWithMetadata;
1574
+ }
1575
+
1576
+ interface SourceTargetPair {
1577
+ /**
1578
+ * The source resource that is defined for move operations.
1579
+ */
1580
+ readonly source?: URI;
1581
+ /**
1582
+ * The target resource the event is about.
1583
+ */
1584
+ readonly target: URI;
1585
+ }
1586
+ interface IFileOperationUndoRedoInfo {
1587
+ /**
1588
+ * Id of the undo group that the file operation belongs to.
1589
+ */
1590
+ undoRedoGroupId?: number;
1591
+ /**
1592
+ * Flag indicates if the operation is an undo.
1593
+ */
1594
+ isUndoing?: boolean;
1595
+ }
1596
+ interface WorkingCopyFileEvent extends IWaitUntil {
1597
+ /**
1598
+ * An identifier to correlate the operation through the
1599
+ * different event types (before, after, error).
1600
+ */
1601
+ readonly correlationId: number;
1602
+ /**
1603
+ * The file operation that is taking place.
1604
+ */
1605
+ readonly operation: FileOperation;
1606
+ /**
1607
+ * The array of source/target pair of files involved in given operation.
1608
+ */
1609
+ readonly files: readonly SourceTargetPair[];
1610
+ }
1611
+ interface IWorkingCopyFileOperationParticipant {
1612
+ /**
1613
+ * Participate in a file operation of working copies. Allows to
1614
+ * change the working copies before they are being saved to disk.
1615
+ */
1616
+ participate(files: SourceTargetPair[], operation: FileOperation, undoInfo: IFileOperationUndoRedoInfo | undefined, timeout: number, token: CancellationToken): Promise<void>;
1617
+ }
1618
+ interface IStoredFileWorkingCopySaveParticipant {
1619
+ /**
1620
+ * Participate in a save operation of file stored working copies.
1621
+ * Allows to make changes before content is being saved to disk.
1622
+ */
1623
+ participate(workingCopy: IStoredFileWorkingCopy<IStoredFileWorkingCopyModel>, context: {
1624
+ reason: SaveReason;
1625
+ }, progress: IProgress<IProgressStep>, token: CancellationToken): Promise<void>;
1626
+ }
1627
+ interface ICreateOperation {
1628
+ resource: URI;
1629
+ overwrite?: boolean;
1630
+ }
1631
+ interface ICreateFileOperation extends ICreateOperation {
1632
+ contents?: VSBuffer | VSBufferReadable | VSBufferReadableStream;
1633
+ }
1634
+ interface IDeleteOperation {
1635
+ resource: URI;
1636
+ useTrash?: boolean;
1637
+ recursive?: boolean;
1638
+ }
1639
+ interface IMoveOperation {
1640
+ file: Required<SourceTargetPair>;
1641
+ overwrite?: boolean;
1642
+ }
1643
+ interface ICopyOperation extends IMoveOperation {
1644
+ }
1645
+ /**
1646
+ * Returns the working copies for a given resource.
1647
+ */
1648
+ type WorkingCopyProvider = (resourceOrFolder: URI) => IWorkingCopy[];
1649
+
1650
+ declare const IWorkingCopyFileService: ServiceIdentifier<IWorkingCopyFileService>;
1651
+ /**
1652
+ * A service that allows to perform file operations with working copy support.
1653
+ * Any operation that would leave a stale dirty working copy behind will make
1654
+ * sure to revert the working copy first.
1655
+ *
1656
+ * On top of that events are provided to participate in each state of the
1657
+ * operation to perform additional work.
1658
+ */
1659
+ interface IWorkingCopyFileService {
1660
+ readonly _serviceBrand: undefined;
1661
+ /**
1662
+ * An event that is fired when a certain working copy IO operation is about to run.
1663
+ *
1664
+ * Participants can join this event with a long running operation to keep some state
1665
+ * before the operation is started, but working copies should not be changed at this
1666
+ * point in time. For that purpose, use the `IWorkingCopyFileOperationParticipant` API.
1667
+ */
1668
+ readonly onWillRunWorkingCopyFileOperation: Event<WorkingCopyFileEvent>;
1669
+ /**
1670
+ * An event that is fired after a working copy IO operation has failed.
1671
+ *
1672
+ * Participants can join this event with a long running operation to clean up as needed.
1673
+ */
1674
+ readonly onDidFailWorkingCopyFileOperation: Event<WorkingCopyFileEvent>;
1675
+ /**
1676
+ * An event that is fired after a working copy IO operation has been performed.
1677
+ *
1678
+ * Participants can join this event with a long running operation to make changes
1679
+ * after the operation has finished.
1680
+ */
1681
+ readonly onDidRunWorkingCopyFileOperation: Event<WorkingCopyFileEvent>;
1682
+ /**
1683
+ * Adds a participant for file operations on working copies.
1684
+ */
1685
+ addFileOperationParticipant(participant: IWorkingCopyFileOperationParticipant): IDisposable;
1686
+ /**
1687
+ * Whether save participants are present for stored file working copies.
1688
+ */
1689
+ get hasSaveParticipants(): boolean;
1690
+ /**
1691
+ * Adds a participant for save operations on stored file working copies.
1692
+ */
1693
+ addSaveParticipant(participant: IStoredFileWorkingCopySaveParticipant): IDisposable;
1694
+ /**
1695
+ * Runs all available save participants for stored file working copies.
1696
+ */
1697
+ runSaveParticipants(workingCopy: IStoredFileWorkingCopy<IStoredFileWorkingCopyModel>, context: {
1698
+ reason: SaveReason;
1699
+ }, token: CancellationToken): Promise<void>;
1700
+ /**
1701
+ * Will create a resource with the provided optional contents, optionally overwriting any target.
1702
+ *
1703
+ * Working copy owners can listen to the `onWillRunWorkingCopyFileOperation` and
1704
+ * `onDidRunWorkingCopyFileOperation` events to participate.
1705
+ */
1706
+ create(operations: ICreateFileOperation[], token: CancellationToken, undoInfo?: IFileOperationUndoRedoInfo): Promise<readonly IFileStatWithMetadata[]>;
1707
+ /**
1708
+ * Will create a folder and any parent folder that needs to be created.
1709
+ *
1710
+ * Working copy owners can listen to the `onWillRunWorkingCopyFileOperation` and
1711
+ * `onDidRunWorkingCopyFileOperation` events to participate.
1712
+ *
1713
+ * Note: events will only be emitted for the provided resource, but not any
1714
+ * parent folders that are being created as part of the operation.
1715
+ */
1716
+ createFolder(operations: ICreateOperation[], token: CancellationToken, undoInfo?: IFileOperationUndoRedoInfo): Promise<readonly IFileStatWithMetadata[]>;
1717
+ /**
1718
+ * Will move working copies matching the provided resources and corresponding children
1719
+ * to the target resources using the associated file service for those resources.
1720
+ *
1721
+ * Working copy owners can listen to the `onWillRunWorkingCopyFileOperation` and
1722
+ * `onDidRunWorkingCopyFileOperation` events to participate.
1723
+ */
1724
+ move(operations: IMoveOperation[], token: CancellationToken, undoInfo?: IFileOperationUndoRedoInfo): Promise<readonly IFileStatWithMetadata[]>;
1725
+ /**
1726
+ * Will copy working copies matching the provided resources and corresponding children
1727
+ * to the target resources using the associated file service for those resources.
1728
+ *
1729
+ * Working copy owners can listen to the `onWillRunWorkingCopyFileOperation` and
1730
+ * `onDidRunWorkingCopyFileOperation` events to participate.
1731
+ */
1732
+ copy(operations: ICopyOperation[], token: CancellationToken, undoInfo?: IFileOperationUndoRedoInfo): Promise<readonly IFileStatWithMetadata[]>;
1733
+ /**
1734
+ * Will delete working copies matching the provided resources and children
1735
+ * using the associated file service for those resources.
1736
+ *
1737
+ * Working copy owners can listen to the `onWillRunWorkingCopyFileOperation` and
1738
+ * `onDidRunWorkingCopyFileOperation` events to participate.
1739
+ */
1740
+ delete(operations: IDeleteOperation[], token: CancellationToken, undoInfo?: IFileOperationUndoRedoInfo): Promise<void>;
1741
+ /**
1742
+ * Register a new provider for working copies based on a resource.
1743
+ *
1744
+ * @return a disposable that unregisters the provider.
1745
+ */
1746
+ registerWorkingCopyProvider(provider: WorkingCopyProvider): IDisposable;
1747
+ /**
1748
+ * Will return all working copies that are dirty matching the provided resource.
1749
+ * If the resource is a folder and the scheme supports file operations, a working
1750
+ * copy that is dirty and is a child of that folder will also be returned.
1751
+ */
1752
+ getDirty(resource: URI): readonly IWorkingCopy[];
1753
+ }
1754
+
1755
+ declare const ITextFileService: ServiceIdentifier<ITextFileService>;
1756
+ interface ITextFileService extends IDisposable {
1757
+ readonly _serviceBrand: undefined;
1758
+ /**
1759
+ * Access to the manager of text file editor models providing further
1760
+ * methods to work with them.
1761
+ */
1762
+ readonly files: ITextFileEditorModelManager;
1763
+ /**
1764
+ * Access to the manager of untitled text editor models providing further
1765
+ * methods to work with them.
1766
+ */
1767
+ readonly untitled: IUntitledTextEditorModelManager;
1768
+ /**
1769
+ * Helper to determine encoding for resources.
1770
+ */
1771
+ readonly encoding: IResourceEncodings;
1772
+ /**
1773
+ * A resource is dirty if it has unsaved changes or is an untitled file not yet saved.
1774
+ *
1775
+ * @param resource the resource to check for being dirty
1776
+ */
1777
+ isDirty(resource: URI): boolean;
1778
+ /**
1779
+ * Saves the resource.
1780
+ *
1781
+ * @param resource the resource to save
1782
+ * @param options optional save options
1783
+ * @return Path of the saved resource or undefined if canceled.
1784
+ */
1785
+ save(resource: URI, options?: ITextFileSaveOptions): Promise<URI | undefined>;
1786
+ /**
1787
+ * Saves the provided resource asking the user for a file name or using the provided one.
1788
+ *
1789
+ * @param resource the resource to save as.
1790
+ * @param targetResource the optional target to save to.
1791
+ * @param options optional save options
1792
+ * @return Path of the saved resource or undefined if canceled.
1793
+ */
1794
+ saveAs(resource: URI, targetResource?: URI, options?: ITextFileSaveAsOptions): Promise<URI | undefined>;
1795
+ /**
1796
+ * Reverts the provided resource.
1797
+ *
1798
+ * @param resource the resource of the file to revert.
1799
+ * @param force to force revert even when the file is not dirty
1800
+ */
1801
+ revert(resource: URI, options?: IRevertOptions): Promise<void>;
1802
+ /**
1803
+ * Read the contents of a file identified by the resource.
1804
+ */
1805
+ read(resource: URI, options?: IReadTextFileOptions): Promise<ITextFileContent>;
1806
+ /**
1807
+ * Read the contents of a file identified by the resource as stream.
1808
+ */
1809
+ readStream(resource: URI, options?: IReadTextFileOptions): Promise<ITextFileStreamContent>;
1810
+ /**
1811
+ * Update a file with given contents.
1812
+ */
1813
+ write(resource: URI, value: string | ITextSnapshot, options?: IWriteTextFileOptions): Promise<IFileStatWithMetadata>;
1814
+ /**
1815
+ * Create files. If the file exists it will be overwritten with the contents if
1816
+ * the options enable to overwrite.
1817
+ */
1818
+ create(operations: {
1819
+ resource: URI;
1820
+ value?: string | ITextSnapshot;
1821
+ options?: {
1822
+ overwrite?: boolean;
1823
+ };
1824
+ }[], undoInfo?: IFileOperationUndoRedoInfo): Promise<readonly IFileStatWithMetadata[]>;
1825
+ /**
1826
+ * Returns the readable that uses the appropriate encoding. This method should
1827
+ * be used whenever a `string` or `ITextSnapshot` is being persisted to the
1828
+ * file system.
1829
+ */
1830
+ getEncodedReadable(resource: URI, value: ITextSnapshot, options?: IWriteTextFileOptions): Promise<VSBufferReadable>;
1831
+ getEncodedReadable(resource: URI, value: string, options?: IWriteTextFileOptions): Promise<VSBuffer>;
1832
+ getEncodedReadable(resource: URI, value?: ITextSnapshot, options?: IWriteTextFileOptions): Promise<VSBufferReadable | undefined>;
1833
+ getEncodedReadable(resource: URI, value?: string, options?: IWriteTextFileOptions): Promise<VSBuffer | undefined>;
1834
+ getEncodedReadable(resource: URI, value?: string | ITextSnapshot, options?: IWriteTextFileOptions): Promise<VSBuffer | VSBufferReadable | undefined>;
1835
+ /**
1836
+ * Returns a stream of strings that uses the appropriate encoding. This method should
1837
+ * be used whenever a `VSBufferReadableStream` is being loaded from the file system.
1838
+ *
1839
+ * Will throw an error if `acceptTextOnly: true` for resources that seem to be binary.
1840
+ */
1841
+ getDecodedStream(resource: URI, value: VSBufferReadableStream, options?: IReadTextFileEncodingOptions): Promise<ReadableStream<string>>;
1842
+ }
1843
+ interface IReadTextFileEncodingOptions {
1844
+ /**
1845
+ * The optional encoding parameter allows to specify the desired encoding when resolving
1846
+ * the contents of the file.
1847
+ */
1848
+ readonly encoding?: string;
1849
+ /**
1850
+ * The optional guessEncoding parameter allows to guess encoding from content of the file.
1851
+ */
1852
+ readonly autoGuessEncoding?: boolean;
1853
+ /**
1854
+ * The optional acceptTextOnly parameter allows to fail this request early if the file
1855
+ * contents are not textual.
1856
+ */
1857
+ readonly acceptTextOnly?: boolean;
1858
+ }
1859
+ interface IReadTextFileOptions extends IReadTextFileEncodingOptions, IReadFileStreamOptions {
1860
+ }
1861
+ interface IWriteTextFileOptions extends IWriteFileOptions {
1862
+ /**
1863
+ * The encoding to use when updating a file.
1864
+ */
1865
+ readonly encoding?: string;
1866
+ /**
1867
+ * Whether to write to the file as elevated (admin) user. When setting this option a prompt will
1868
+ * ask the user to authenticate as super user.
1869
+ */
1870
+ readonly writeElevated?: boolean;
1871
+ }
1872
+ interface IResourceEncodings {
1873
+ getPreferredReadEncoding(resource: URI): Promise<IResourceEncoding>;
1874
+ getPreferredWriteEncoding(resource: URI, preferredEncoding?: string): Promise<IResourceEncoding>;
1875
+ }
1876
+ interface IResourceEncoding {
1877
+ readonly encoding: string;
1878
+ readonly hasBOM: boolean;
1879
+ }
1880
+ /**
1881
+ * The save error handler can be installed on the text file editor model to install code that executes when save errors occur.
1882
+ */
1883
+ interface ISaveErrorHandler {
1884
+ /**
1885
+ * Called whenever a save fails.
1886
+ */
1887
+ onSaveError(error: Error, model: ITextFileEditorModel): void;
1888
+ }
1889
+ /**
1890
+ * States the text file editor model can be in.
1891
+ */
1892
+ declare const enum TextFileEditorModelState {
1893
+ /**
1894
+ * A model is saved.
1895
+ */
1896
+ SAVED = 0,
1897
+ /**
1898
+ * A model is dirty.
1899
+ */
1900
+ DIRTY = 1,
1901
+ /**
1902
+ * A model is currently being saved but this operation has not completed yet.
1903
+ */
1904
+ PENDING_SAVE = 2,
1905
+ /**
1906
+ * A model is in conflict mode when changes cannot be saved because the
1907
+ * underlying file has changed. Models in conflict mode are always dirty.
1908
+ */
1909
+ CONFLICT = 3,
1910
+ /**
1911
+ * A model is in orphan state when the underlying file has been deleted.
1912
+ */
1913
+ ORPHAN = 4,
1914
+ /**
1915
+ * Any error that happens during a save that is not causing the CONFLICT state.
1916
+ * Models in error mode are always dirty.
1917
+ */
1918
+ ERROR = 5
1919
+ }
1920
+ declare const enum TextFileResolveReason {
1921
+ EDITOR = 1,
1922
+ REFERENCE = 2,
1923
+ OTHER = 3
1924
+ }
1925
+ interface IBaseTextFileContent extends IBaseFileStatWithMetadata {
1926
+ /**
1927
+ * The encoding of the content if known.
1928
+ */
1929
+ readonly encoding: string;
1930
+ }
1931
+ interface ITextFileContent extends IBaseTextFileContent {
1932
+ /**
1933
+ * The content of a text file.
1934
+ */
1935
+ readonly value: string;
1936
+ }
1937
+ interface ITextFileStreamContent extends IBaseTextFileContent {
1938
+ /**
1939
+ * The line grouped content of a text file.
1940
+ */
1941
+ readonly value: ITextBufferFactory;
1942
+ }
1943
+ interface ITextFileEditorModelResolveOrCreateOptions extends ITextFileResolveOptions {
1944
+ /**
1945
+ * The language id to use for the model text content.
1946
+ */
1947
+ readonly languageId?: string;
1948
+ /**
1949
+ * The encoding to use when resolving the model text content.
1950
+ */
1951
+ readonly encoding?: string;
1952
+ /**
1953
+ * If the model was already resolved before, allows to trigger
1954
+ * a reload of it to fetch the latest contents.
1955
+ */
1956
+ readonly reload?: {
1957
+ /**
1958
+ * Controls whether the reload happens in the background
1959
+ * or whether `resolve` will await the reload to happen.
1960
+ */
1961
+ readonly async: boolean;
1962
+ };
1963
+ }
1964
+ interface ITextFileSaveEvent extends ITextFileEditorModelSaveEvent {
1965
+ /**
1966
+ * The model that was saved.
1967
+ */
1968
+ readonly model: ITextFileEditorModel;
1969
+ }
1970
+ interface ITextFileResolveEvent {
1971
+ /**
1972
+ * The model that was resolved.
1973
+ */
1974
+ readonly model: ITextFileEditorModel;
1975
+ /**
1976
+ * The reason why the model was resolved.
1977
+ */
1978
+ readonly reason: TextFileResolveReason;
1979
+ }
1980
+ interface ITextFileSaveParticipant {
1981
+ /**
1982
+ * Participate in a save of a model. Allows to change the model
1983
+ * before it is being saved to disk.
1984
+ */
1985
+ participate(model: ITextFileEditorModel, context: {
1986
+ reason: SaveReason;
1987
+ }, progress: IProgress<IProgressStep>, token: CancellationToken): Promise<void>;
1988
+ }
1989
+ interface ITextFileEditorModelManager {
1990
+ readonly onDidCreate: Event<ITextFileEditorModel>;
1991
+ readonly onDidResolve: Event<ITextFileResolveEvent>;
1992
+ readonly onDidChangeDirty: Event<ITextFileEditorModel>;
1993
+ readonly onDidChangeReadonly: Event<ITextFileEditorModel>;
1994
+ readonly onDidRemove: Event<URI>;
1995
+ readonly onDidChangeOrphaned: Event<ITextFileEditorModel>;
1996
+ readonly onDidChangeEncoding: Event<ITextFileEditorModel>;
1997
+ readonly onDidSaveError: Event<ITextFileEditorModel>;
1998
+ readonly onDidSave: Event<ITextFileSaveEvent>;
1999
+ readonly onDidRevert: Event<ITextFileEditorModel>;
2000
+ /**
2001
+ * Access to all text file editor models in memory.
2002
+ */
2003
+ readonly models: ITextFileEditorModel[];
2004
+ /**
2005
+ * Allows to configure the error handler that is called on save errors.
2006
+ */
2007
+ saveErrorHandler: ISaveErrorHandler;
2008
+ /**
2009
+ * Returns the text file editor model for the provided resource
2010
+ * or undefined if none.
2011
+ */
2012
+ get(resource: URI): ITextFileEditorModel | undefined;
2013
+ /**
2014
+ * Allows to resolve a text file model from disk.
2015
+ */
2016
+ resolve(resource: URI, options?: ITextFileEditorModelResolveOrCreateOptions): Promise<ITextFileEditorModel>;
2017
+ /**
2018
+ * Adds a participant for saving text file models.
2019
+ */
2020
+ addSaveParticipant(participant: ITextFileSaveParticipant): IDisposable;
2021
+ /**
2022
+ * Runs the registered save participants on the provided model.
2023
+ */
2024
+ runSaveParticipants(model: ITextFileEditorModel, context: {
2025
+ reason: SaveReason;
2026
+ }, token: CancellationToken): Promise<void>;
2027
+ /**
2028
+ * Waits for the model to be ready to be disposed. There may be conditions
2029
+ * under which the model cannot be disposed, e.g. when it is dirty. Once the
2030
+ * promise is settled, it is safe to dispose the model.
2031
+ */
2032
+ canDispose(model: ITextFileEditorModel): true | Promise<true>;
2033
+ }
2034
+ interface ITextFileSaveOptions extends ISaveOptions {
2035
+ /**
2036
+ * Save the file with an attempt to unlock it.
2037
+ */
2038
+ readonly writeUnlock?: boolean;
2039
+ /**
2040
+ * Save the file with elevated privileges.
2041
+ *
2042
+ * Note: This may not be supported in all environments.
2043
+ */
2044
+ readonly writeElevated?: boolean;
2045
+ /**
2046
+ * Allows to write to a file even if it has been modified on disk.
2047
+ */
2048
+ readonly ignoreModifiedSince?: boolean;
2049
+ /**
2050
+ * If set, will bubble up the error to the caller instead of handling it.
2051
+ */
2052
+ readonly ignoreErrorHandler?: boolean;
2053
+ }
2054
+ interface ITextFileSaveAsOptions extends ITextFileSaveOptions {
2055
+ /**
2056
+ * Optional URI to use as suggested file path to save as.
2057
+ */
2058
+ readonly suggestedTarget?: URI;
2059
+ }
2060
+ interface ITextFileResolveOptions {
2061
+ /**
2062
+ * The contents to use for the model if known. If not
2063
+ * provided, the contents will be retrieved from the
2064
+ * underlying resource or backup if present.
2065
+ */
2066
+ readonly contents?: ITextBufferFactory;
2067
+ /**
2068
+ * Go to file bypassing any cache of the model if any.
2069
+ */
2070
+ readonly forceReadFromFile?: boolean;
2071
+ /**
2072
+ * Allow to resolve a model even if we think it is a binary file.
2073
+ */
2074
+ readonly allowBinary?: boolean;
2075
+ /**
2076
+ * Context why the model is being resolved.
2077
+ */
2078
+ readonly reason?: TextFileResolveReason;
2079
+ /**
2080
+ * If provided, the size of the file will be checked against the limits
2081
+ * and an error will be thrown if any limit is exceeded.
2082
+ */
2083
+ readonly limits?: IFileReadLimits;
2084
+ }
2085
+ declare const enum EncodingMode {
2086
+ /**
2087
+ * Instructs the encoding support to encode the object with the provided encoding
2088
+ */
2089
+ Encode = 0,
2090
+ /**
2091
+ * Instructs the encoding support to decode the object with the provided encoding
2092
+ */
2093
+ Decode = 1
2094
+ }
2095
+ interface IEncodingSupport {
2096
+ /**
2097
+ * Gets the encoding of the object if known.
2098
+ */
2099
+ getEncoding(): string | undefined;
2100
+ /**
2101
+ * Sets the encoding for the object for saving.
2102
+ */
2103
+ setEncoding(encoding: string, mode: EncodingMode): Promise<void>;
2104
+ }
2105
+ interface ILanguageSupport {
2106
+ /**
2107
+ * Sets the language id of the object.
2108
+ */
2109
+ setLanguageId(languageId: string, source?: string): void;
2110
+ }
2111
+ interface ITextFileEditorModelSaveEvent extends IWorkingCopySaveEvent {
2112
+ /**
2113
+ * The resolved stat from the save operation.
2114
+ */
2115
+ readonly stat: IFileStatWithMetadata;
2116
+ }
2117
+ interface ITextFileEditorModel extends ITextEditorModel, IEncodingSupport, ILanguageSupport, IWorkingCopy {
2118
+ readonly onDidSave: Event<ITextFileEditorModelSaveEvent>;
2119
+ readonly onDidSaveError: Event<void>;
2120
+ readonly onDidChangeOrphaned: Event<void>;
2121
+ readonly onDidChangeReadonly: Event<void>;
2122
+ readonly onDidChangeEncoding: Event<void>;
2123
+ hasState(state: TextFileEditorModelState): boolean;
2124
+ joinState(state: TextFileEditorModelState.PENDING_SAVE): Promise<void>;
2125
+ updatePreferredEncoding(encoding: string | undefined): void;
2126
+ save(options?: ITextFileSaveOptions): Promise<boolean>;
2127
+ revert(options?: IRevertOptions): Promise<void>;
2128
+ resolve(options?: ITextFileResolveOptions): Promise<void>;
2129
+ isDirty(): this is IResolvedTextFileEditorModel;
2130
+ getLanguageId(): string | undefined;
2131
+ isResolved(): this is IResolvedTextFileEditorModel;
2132
+ }
2133
+ interface IResolvedTextFileEditorModel extends ITextFileEditorModel {
2134
+ readonly textEditorModel: ITextModel;
2135
+ createSnapshot(): ITextSnapshot;
2136
+ }
2137
+
1041
2138
  interface IEditorDescriptor<T extends IEditorPane> {
1042
2139
  /**
1043
2140
  * The unique type identifier of the editor. All instances
@@ -1461,10 +2558,92 @@ declare const enum EditorInputCapabilities {
1461
2558
  type IUntypedEditorInput = IResourceEditorInput | ITextResourceEditorInput | IUntitledTextResourceEditorInput | IResourceDiffEditorInput | IResourceSideBySideEditorInput | IResourceMergeEditorInput;
1462
2559
  declare abstract class AbstractEditorInput extends Disposable {
1463
2560
  }
2561
+ interface EditorInputWithPreferredResource {
2562
+ /**
2563
+ * An editor may provide an additional preferred resource alongside
2564
+ * the `resource` property. While the `resource` property serves as
2565
+ * unique identifier of the editor that should be used whenever we
2566
+ * compare to other editors, the `preferredResource` should be used
2567
+ * in places where e.g. the resource is shown to the user.
2568
+ *
2569
+ * For example: on Windows and macOS, the same URI with different
2570
+ * casing may point to the same file. The editor may chose to
2571
+ * "normalize" the URIs so that only one editor opens for different
2572
+ * URIs. But when displaying the editor label to the user, the
2573
+ * preferred URI should be used.
2574
+ *
2575
+ * Not all editors have a `preferredResource`. The `EditorResourceAccessor`
2576
+ * utility can be used to always get the right resource without having
2577
+ * to do instanceof checks.
2578
+ */
2579
+ readonly preferredResource: URI;
2580
+ }
2581
+ interface IUntypedFileEditorInput extends ITextResourceEditorInput {
2582
+ /**
2583
+ * A marker to create a `IFileEditorInput` from this untyped input.
2584
+ */
2585
+ forceFile: true;
2586
+ }
2587
+ /**
2588
+ * This is a tagging interface to declare an editor input being capable of dealing with files. It is only used in the editor registry
2589
+ * to register this kind of input to the platform.
2590
+ */
2591
+ interface IFileEditorInput extends EditorInput, IEncodingSupport, ILanguageSupport, EditorInputWithPreferredResource {
2592
+ /**
2593
+ * Gets the resource this file input is about. This will always be the
2594
+ * canonical form of the resource, so it may differ from the original
2595
+ * resource that was provided to create the input. Use `preferredResource`
2596
+ * for the form as it was created.
2597
+ */
2598
+ readonly resource: URI;
2599
+ /**
2600
+ * Sets the preferred resource to use for this file input.
2601
+ */
2602
+ setPreferredResource(preferredResource: URI): void;
2603
+ /**
2604
+ * Sets the preferred name to use for this file input.
2605
+ *
2606
+ * Note: for certain file schemes the input may decide to ignore this
2607
+ * name and use our standard naming. Specifically for schemes we own,
2608
+ * we do not let others override the name.
2609
+ */
2610
+ setPreferredName(name: string): void;
2611
+ /**
2612
+ * Sets the preferred description to use for this file input.
2613
+ *
2614
+ * Note: for certain file schemes the input may decide to ignore this
2615
+ * description and use our standard naming. Specifically for schemes we own,
2616
+ * we do not let others override the description.
2617
+ */
2618
+ setPreferredDescription(description: string): void;
2619
+ /**
2620
+ * Sets the preferred encoding to use for this file input.
2621
+ */
2622
+ setPreferredEncoding(encoding: string): void;
2623
+ /**
2624
+ * Sets the preferred language id to use for this file input.
2625
+ */
2626
+ setPreferredLanguageId(languageId: string): void;
2627
+ /**
2628
+ * Sets the preferred contents to use for this file input.
2629
+ */
2630
+ setPreferredContents(contents: string): void;
2631
+ /**
2632
+ * Forces this file input to open as binary instead of text.
2633
+ */
2634
+ setForceOpenAsBinary(): void;
2635
+ /**
2636
+ * Figure out if the file input has been resolved or not.
2637
+ */
2638
+ isResolved(): boolean;
2639
+ }
1464
2640
  interface EditorInputWithOptions {
1465
2641
  editor: EditorInput;
1466
2642
  options?: IEditorOptions;
1467
2643
  }
2644
+ interface EditorInputWithOptionsAndGroup extends EditorInputWithOptions {
2645
+ group: IEditorGroup;
2646
+ }
1468
2647
  interface IEditorIdentifier {
1469
2648
  groupId: GroupIdentifier;
1470
2649
  editor: EditorInput;
@@ -1626,4 +2805,4 @@ declare const enum EditorsOrder {
1626
2805
  SEQUENTIAL = 1
1627
2806
  }
1628
2807
 
1629
- export { ICheckbox as $, IAddGroupOptions as A, IMergeGroupOptions as B, ICloseEditorsFilter as C, ICloseAllEditorsOptions as D, EditorInput as E, GroupsOrder as F, GroupIdentifier as G, IEditorSideGroup as H, IEditorCloseEvent as I, CloseDirection as J, IEditorPartOptions as K, IEditorPartOptionsChangeEvent as L, MergeGroupMode as M, IEditorWillMoveEvent as N, IEditorWillOpenEvent as O, IMatchEditorOptions as P, IActiveEditorChangeEvent as Q, IEditorControl as R, SaveReason as S, IDialogArgs as T, DialogType as U, IDialogResult as V, IDialogHandler as W, IConfirmDialogArgs as X, IInputDialogArgs as Y, IPromptDialogArgs as Z, IBaseDialogOptions as _, IVisibleEditorPane as a, ICheckboxResult as a0, ICustomDialogOptions as a1, ICustomDialogMarkdown as a2, IConfirmation as a3, IConfirmationResult as a4, IInput as a5, IInputResult as a6, IInputElement as a7, IPrompt as a8, IPromptResult as a9, IPromptBaseButton as aa, IPromptButton as ab, IPromptCancelButton as ac, IPromptResultWithCancel as ad, IPromptWithCustomCancel as ae, IPromptWithDefaultCancel as af, EditorsOrder as b, IEditorIdentifier as c, IEditorPane as d, IUntypedEditorInput as e, IUntitledTextResourceEditorInput as f, IResourceDiffEditorInput as g, ITextDiffEditorPane as h, EditorInputWithOptions as i, IEditorReplacement as j, IEditorGroup as k, IFindEditorOptions as l, IRevertOptions as m, ICloseEditorOptions as n, ISaveOptions as o, IGroupModelChangeEvent as p, SaveSource as q, IDialogService as r, IEditorGroupsService as s, GroupDirection as t, GroupOrientation as u, GroupLocation as v, IFindGroupScope as w, GroupsArrangement as x, GroupLayoutArgument as y, EditorGroupLayout as z };
2808
+ export { IDialogHandler as $, IFindGroupScope as A, GroupsArrangement as B, GroupLayoutArgument as C, EditorGroupLayout as D, EditorInput as E, IAddGroupOptions as F, GroupIdentifier as G, IMergeGroupOptions as H, IEditorCloseEvent as I, ICloseEditorsFilter as J, ICloseAllEditorsOptions as K, GroupsOrder as L, MergeGroupMode as M, IEditorSideGroup as N, CloseDirection as O, IEditorPartOptions as P, IEditorPartOptionsChangeEvent as Q, IEditorWillMoveEvent as R, IEditorWillOpenEvent as S, IMatchEditorOptions as T, IActiveEditorChangeEvent as U, IEditorControl as V, ITextFileService as W, IWorkingCopyFileService as X, IDialogArgs as Y, DialogType as Z, IDialogResult as _, IVisibleEditorPane as a, IConfirmDialogArgs as a0, IInputDialogArgs as a1, IPromptDialogArgs as a2, IBaseDialogOptions as a3, ICheckbox as a4, ICheckboxResult as a5, ICustomDialogOptions as a6, ICustomDialogMarkdown as a7, IConfirmation as a8, IConfirmationResult as a9, IInput as aa, IInputResult as ab, IInputElement as ac, IPrompt as ad, IPromptResult as ae, IPromptBaseButton as af, IPromptButton as ag, IPromptCancelButton as ah, IPromptResultWithCancel as ai, IPromptWithCustomCancel as aj, IPromptWithDefaultCancel as ak, EditorsOrder as b, IEditorIdentifier as c, IEditorPane as d, IUntypedEditorInput as e, IUntitledTextResourceEditorInput as f, IResourceDiffEditorInput as g, ITextDiffEditorPane as h, EditorInputWithOptions as i, IEditorReplacement as j, IEditorGroup as k, IFindEditorOptions as l, IRevertOptions as m, ICloseEditorOptions as n, ISaveOptions as o, IGroupModelChangeEvent as p, ITextFileEditorModel as q, EditorInputWithOptionsAndGroup as r, IResourceMergeEditorInput as s, IUntypedFileEditorInput as t, IFileEditorInput as u, IDialogService as v, IEditorGroupsService as w, GroupDirection as x, GroupOrientation as y, GroupLocation as z };