@codingame/monaco-vscode-files-service-override 11.1.2 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,14 @@
1
- import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
1
+
2
+ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
2
3
  import { localize } from 'vscode/vscode/vs/nls';
3
4
  import { toErrorMessage } from 'vscode/vscode/vs/base/common/errorMessage';
4
5
  import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
5
6
  import { URI } from 'vscode/vscode/vs/base/common/uri';
6
- import { TextFileEditorModel } from 'vscode/vscode/vs/workbench/services/textfile/common/textFileEditorModel';
7
+ import { TextFileEditorModel } from '@codingame/monaco-vscode-0c06bfba-d24d-5c4d-90cd-b40cefb7f811-common/vscode/vs/workbench/services/textfile/common/textFileEditorModel';
7
8
  import { Disposable, DisposableStore, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
8
9
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
9
10
  import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
11
+ import { FileChangeType, FileOperation } from 'vscode/vscode/vs/platform/files/common/files';
10
12
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
11
13
  import { ResourceQueue, Promises } from 'vscode/vscode/vs/base/common/async';
12
14
  import { onUnexpectedError } from 'vscode/vscode/vs/base/common/errors';
@@ -20,7 +22,7 @@ import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/commo
20
22
 
21
23
  let TextFileEditorModelManager = class TextFileEditorModelManager extends Disposable {
22
24
  get models() {
23
- return [...( (this.mapResourceToModel.values()))];
25
+ return [...( this.mapResourceToModel.values())];
24
26
  }
25
27
  constructor(instantiationService, fileService, notificationService, workingCopyFileService, uriIdentityService) {
26
28
  super();
@@ -29,39 +31,39 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
29
31
  this.notificationService = notificationService;
30
32
  this.workingCopyFileService = workingCopyFileService;
31
33
  this.uriIdentityService = uriIdentityService;
32
- this._onDidCreate = this._register(( (new Emitter(
34
+ this._onDidCreate = this._register(( new Emitter(
33
35
  { leakWarningThreshold: 500 }
34
- ))));
36
+ )));
35
37
  this.onDidCreate = this._onDidCreate.event;
36
- this._onDidResolve = this._register(( (new Emitter())));
38
+ this._onDidResolve = this._register(( new Emitter()));
37
39
  this.onDidResolve = this._onDidResolve.event;
38
- this._onDidRemove = this._register(( (new Emitter())));
40
+ this._onDidRemove = this._register(( new Emitter()));
39
41
  this.onDidRemove = this._onDidRemove.event;
40
- this._onDidChangeDirty = this._register(( (new Emitter())));
42
+ this._onDidChangeDirty = this._register(( new Emitter()));
41
43
  this.onDidChangeDirty = this._onDidChangeDirty.event;
42
- this._onDidChangeReadonly = this._register(( (new Emitter())));
44
+ this._onDidChangeReadonly = this._register(( new Emitter()));
43
45
  this.onDidChangeReadonly = this._onDidChangeReadonly.event;
44
- this._onDidChangeOrphaned = this._register(( (new Emitter())));
46
+ this._onDidChangeOrphaned = this._register(( new Emitter()));
45
47
  this.onDidChangeOrphaned = this._onDidChangeOrphaned.event;
46
- this._onDidSaveError = this._register(( (new Emitter())));
48
+ this._onDidSaveError = this._register(( new Emitter()));
47
49
  this.onDidSaveError = this._onDidSaveError.event;
48
- this._onDidSave = this._register(( (new Emitter())));
50
+ this._onDidSave = this._register(( new Emitter()));
49
51
  this.onDidSave = this._onDidSave.event;
50
- this._onDidRevert = this._register(( (new Emitter())));
52
+ this._onDidRevert = this._register(( new Emitter()));
51
53
  this.onDidRevert = this._onDidRevert.event;
52
- this._onDidChangeEncoding = this._register(( (new Emitter())));
54
+ this._onDidChangeEncoding = this._register(( new Emitter()));
53
55
  this.onDidChangeEncoding = this._onDidChangeEncoding.event;
54
- this.mapResourceToModel = ( (new ResourceMap()));
55
- this.mapResourceToModelListeners = ( (new ResourceMap()));
56
- this.mapResourceToDisposeListener = ( (new ResourceMap()));
57
- this.mapResourceToPendingModelResolvers = ( (new ResourceMap()));
58
- this.modelResolveQueue = this._register(( (new ResourceQueue())));
56
+ this.mapResourceToModel = ( new ResourceMap());
57
+ this.mapResourceToModelListeners = ( new ResourceMap());
58
+ this.mapResourceToDisposeListener = ( new ResourceMap());
59
+ this.mapResourceToPendingModelResolvers = ( new ResourceMap());
60
+ this.modelResolveQueue = this._register(( new ResourceQueue()));
59
61
  this.saveErrorHandler = (() => {
60
62
  const notificationService = this.notificationService;
61
63
  return {
62
64
  onSaveError(error, model) {
63
65
  notificationService.error(( localize(
64
- 9983,
66
+ 11774,
65
67
  "Failed to save '{0}': {1}",
66
68
  model.name,
67
69
  toErrorMessage(error, false)
@@ -69,7 +71,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
69
71
  }
70
72
  };
71
73
  })();
72
- this.mapCorrelationIdToModelsToRestore = ( (new Map()));
74
+ this.mapCorrelationIdToModelsToRestore = ( new Map());
73
75
  this.saveParticipants = this._register(this.instantiationService.createInstance(TextFileSaveParticipant));
74
76
  this.registerListeners();
75
77
  }
@@ -86,7 +88,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
86
88
  if (model.isDirty()) {
87
89
  continue;
88
90
  }
89
- if (e.contains(model.resource, 0 , 1 )) {
91
+ if (e.contains(model.resource, FileChangeType.UPDATED, FileChangeType.ADDED)) {
90
92
  this.queueModelReload(model);
91
93
  }
92
94
  }
@@ -124,7 +126,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
124
126
  }
125
127
  }
126
128
  onWillRunWorkingCopyFileOperation(e) {
127
- if (e.operation === 2 || e.operation === 3 ) {
129
+ if (e.operation === FileOperation.MOVE || e.operation === FileOperation.COPY) {
128
130
  const modelsToRestore = [];
129
131
  for (const { source, target } of e.files) {
130
132
  if (source) {
@@ -160,7 +162,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
160
162
  }
161
163
  }
162
164
  onDidFailWorkingCopyFileOperation(e) {
163
- if (((e.operation === 2 || e.operation === 3) )) {
165
+ if ((e.operation === FileOperation.MOVE || e.operation === FileOperation.COPY)) {
164
166
  const modelsToRestore = this.mapCorrelationIdToModelsToRestore.get(e.correlationId);
165
167
  if (modelsToRestore) {
166
168
  this.mapCorrelationIdToModelsToRestore.delete(e.correlationId);
@@ -174,7 +176,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
174
176
  }
175
177
  onDidRunWorkingCopyFileOperation(e) {
176
178
  switch (e.operation) {
177
- case 0 :
179
+ case FileOperation.CREATE:
178
180
  e.waitUntil((async () => {
179
181
  for (const { target } of e.files) {
180
182
  const model = this.get(target);
@@ -184,13 +186,13 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
184
186
  }
185
187
  })());
186
188
  break;
187
- case 2 :
188
- case 3 :
189
+ case FileOperation.MOVE:
190
+ case FileOperation.COPY:
189
191
  e.waitUntil((async () => {
190
192
  const modelsToRestore = this.mapCorrelationIdToModelsToRestore.get(e.correlationId);
191
193
  if (modelsToRestore) {
192
194
  this.mapCorrelationIdToModelsToRestore.delete(e.correlationId);
193
- await Promises.settled(( (modelsToRestore.map(async (modelToRestore) => {
195
+ await Promises.settled(( modelsToRestore.map(async (modelToRestore) => {
194
196
  const target = this.uriIdentityService.asCanonicalUri(modelToRestore.target);
195
197
  const restoredModel = await this.resolve(target, {
196
198
  reload: { async: false },
@@ -203,7 +205,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
203
205
  extname(target) !== PLAINTEXT_EXTENSION) {
204
206
  restoredModel.updateTextEditorModel(undefined, modelToRestore.languageId);
205
207
  }
206
- }))));
208
+ })));
207
209
  }
208
210
  })());
209
211
  break;
@@ -213,13 +215,11 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
213
215
  return this.mapResourceToModel.get(resource);
214
216
  }
215
217
  has(resource) {
216
- return (
217
- (this.mapResourceToModel.has(resource))
218
- );
218
+ return ( this.mapResourceToModel.has(resource));
219
219
  }
220
220
  async reload(model) {
221
221
  await this.joinPendingResolves(model.resource);
222
- if (model.isDirty() || model.isDisposed() || !( (this.has(model.resource)))) {
222
+ if (model.isDirty() || model.isDisposed() || !( this.has(model.resource))) {
223
223
  return;
224
224
  }
225
225
  await this.doResolve(model, { reload: { async: false } });
@@ -311,7 +311,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
311
311
  }
312
312
  async doJoinPendingResolves(resource) {
313
313
  let currentModelCopyResolve;
314
- while (( (this.mapResourceToPendingModelResolvers.has(resource)))) {
314
+ while (( this.mapResourceToPendingModelResolvers.has(resource))) {
315
315
  const nextPendingModelResolve = this.mapResourceToPendingModelResolvers.get(resource);
316
316
  if (nextPendingModelResolve === currentModelCopyResolve) {
317
317
  return;
@@ -325,7 +325,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
325
325
  }
326
326
  }
327
327
  registerModel(model) {
328
- const modelListeners = ( (new DisposableStore()));
328
+ const modelListeners = ( new DisposableStore());
329
329
  modelListeners.add(model.onDidResolve(reason => this._onDidResolve.fire({ model, reason })));
330
330
  modelListeners.add(model.onDidChangeDirty(() => this._onDidChangeDirty.fire(model)));
331
331
  modelListeners.add(model.onDidChangeReadonly(() => this._onDidChangeReadonly.fire(model)));
@@ -370,7 +370,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
370
370
  }
371
371
  canDispose(model) {
372
372
  if (model.isDisposed() ||
373
- (!( (this.mapResourceToPendingModelResolvers.has(model.resource))) && !model.isDirty())) {
373
+ (!( this.mapResourceToPendingModelResolvers.has(model.resource)) && !model.isDirty())) {
374
374
  return true;
375
375
  }
376
376
  return this.doCanDispose(model);
@@ -391,18 +391,18 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
391
391
  super.dispose();
392
392
  this.mapResourceToModel.clear();
393
393
  this.mapResourceToPendingModelResolvers.clear();
394
- dispose(( (this.mapResourceToDisposeListener.values())));
394
+ dispose(( this.mapResourceToDisposeListener.values()));
395
395
  this.mapResourceToDisposeListener.clear();
396
- dispose(( (this.mapResourceToModelListeners.values())));
396
+ dispose(( this.mapResourceToModelListeners.values()));
397
397
  this.mapResourceToModelListeners.clear();
398
398
  }
399
399
  };
400
- TextFileEditorModelManager = ( (__decorate([
401
- ( (__param(0, IInstantiationService))),
402
- ( (__param(1, IFileService))),
403
- ( (__param(2, INotificationService))),
404
- ( (__param(3, IWorkingCopyFileService))),
405
- ( (__param(4, IUriIdentityService)))
406
- ], TextFileEditorModelManager)));
400
+ TextFileEditorModelManager = ( __decorate([
401
+ ( __param(0, IInstantiationService)),
402
+ ( __param(1, IFileService)),
403
+ ( __param(2, INotificationService)),
404
+ ( __param(3, IWorkingCopyFileService)),
405
+ ( __param(4, IUriIdentityService))
406
+ ], TextFileEditorModelManager));
407
407
 
408
408
  export { TextFileEditorModelManager };
@@ -0,0 +1,15 @@
1
+ import { CancellationToken } from "vscode/vscode/vs/base/common/cancellation";
2
+ import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
3
+ import { IProgress, IProgressStep } from "vscode/vscode/vs/platform/progress/common/progress";
4
+ import { IProgressService } from "vscode/vscode/vs/platform/progress/common/progress.service";
5
+ import { ITextFileSaveParticipant, ITextFileEditorModel, ITextFileSaveParticipantContext } from "vscode/vscode/vs/workbench/services/textfile/common/textfiles";
6
+ import { IDisposable, Disposable } from "vscode/vscode/vs/base/common/lifecycle";
7
+ export declare class TextFileSaveParticipant extends Disposable {
8
+ private readonly logService;
9
+ private readonly progressService;
10
+ private readonly saveParticipants;
11
+ constructor(logService: ILogService, progressService: IProgressService);
12
+ addSaveParticipant(participant: ITextFileSaveParticipant): IDisposable;
13
+ participate(model: ITextFileEditorModel, context: ITextFileSaveParticipantContext, progress: IProgress<IProgressStep>, token: CancellationToken): Promise<void>;
14
+ dispose(): void;
15
+ }
@@ -1,7 +1,9 @@
1
- import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
1
+
2
+ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
2
3
  import { raceCancellation } from 'vscode/vscode/vs/base/common/async';
3
4
  import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
4
5
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
6
+ import { ProgressLocation } from 'vscode/vscode/vs/platform/progress/common/progress';
5
7
  import { IProgressService } from 'vscode/vscode/vs/platform/progress/common/progress.service';
6
8
  import { Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
7
9
  import { LinkedList } from 'vscode/vscode/vs/base/common/linkedList';
@@ -14,23 +16,23 @@ let TextFileSaveParticipant = class TextFileSaveParticipant extends Disposable {
14
16
  super();
15
17
  this.logService = logService;
16
18
  this.progressService = progressService;
17
- this.saveParticipants = ( (new LinkedList()));
19
+ this.saveParticipants = ( new LinkedList());
18
20
  }
19
21
  addSaveParticipant(participant) {
20
22
  const remove = this.saveParticipants.push(participant);
21
23
  return toDisposable(() => remove());
22
24
  }
23
25
  async participate(model, context, progress, token) {
24
- const cts = ( (new CancellationTokenSource(token)));
26
+ const cts = ( new CancellationTokenSource(token));
25
27
  model.textEditorModel?.pushStackElement();
26
28
  progress.report({
27
- message: ( localize(11516, "Running Code Actions and Formatters..."))
29
+ message: ( localize(11775, "Running Code Actions and Formatters..."))
28
30
  });
29
31
  let bubbleCancel = false;
30
32
  await this.progressService.withProgress({
31
33
  priority: NotificationPriority.URGENT,
32
- location: 15 ,
33
- cancellable: ( localize(11517, "Skip")),
34
+ location: ProgressLocation.Notification,
35
+ cancellable: ( localize(11776, "Skip")),
34
36
  delay: model.isDirty() ? 5000 : 3000
35
37
  }, async (progress) => {
36
38
  for (const saveParticipant of this.saveParticipants) {
@@ -57,7 +59,7 @@ let TextFileSaveParticipant = class TextFileSaveParticipant extends Disposable {
57
59
  model.textEditorModel?.pushStackElement();
58
60
  cts.dispose();
59
61
  if (bubbleCancel) {
60
- throw ( (new CancellationError()));
62
+ throw ( new CancellationError());
61
63
  }
62
64
  }
63
65
  dispose() {
@@ -65,9 +67,9 @@ let TextFileSaveParticipant = class TextFileSaveParticipant extends Disposable {
65
67
  super.dispose();
66
68
  }
67
69
  };
68
- TextFileSaveParticipant = ( (__decorate([
69
- ( (__param(0, ILogService))),
70
- ( (__param(1, IProgressService)))
71
- ], TextFileSaveParticipant)));
70
+ TextFileSaveParticipant = ( __decorate([
71
+ ( __param(0, ILogService)),
72
+ ( __param(1, IProgressService))
73
+ ], TextFileSaveParticipant));
72
74
 
73
75
  export { TextFileSaveParticipant };