@codingame/monaco-vscode-files-service-override 6.0.2 → 7.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-files-service-override",
3
- "version": "6.0.2",
3
+ "version": "7.0.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -26,6 +26,6 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "vscode": "npm:@codingame/monaco-vscode-api@6.0.2"
29
+ "vscode": "npm:@codingame/monaco-vscode-api@7.0.0"
30
30
  }
31
31
  }
@@ -224,7 +224,10 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
224
224
  doGetDecodedStream(resource, stream, options) {
225
225
  return toDecodeStream(stream, {
226
226
  acceptTextOnly: options?.acceptTextOnly ?? false,
227
- guessEncoding: options?.autoGuessEncoding || this.textResourceConfigurationService.getValue(resource, 'files.autoGuessEncoding'),
227
+ guessEncoding: options?.autoGuessEncoding ||
228
+ this.textResourceConfigurationService.getValue(resource, 'files.autoGuessEncoding'),
229
+ candidateGuessEncodings: options?.candidateGuessEncodings ||
230
+ this.textResourceConfigurationService.getValue(resource, 'files.candidateGuessEncodings'),
228
231
  overwriteEncoding: async (detectedEncoding) => {
229
232
  const { encoding } = await this.encoding.getPreferredReadEncoding(resource, options, detectedEncoding ?? undefined);
230
233
  return encoding;
@@ -368,8 +368,8 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
368
368
  addSaveParticipant(participant) {
369
369
  return this.saveParticipants.addSaveParticipant(participant);
370
370
  }
371
- runSaveParticipants(model, context, token) {
372
- return this.saveParticipants.participate(model, context, token);
371
+ runSaveParticipants(model, context, progress, token) {
372
+ return this.saveParticipants.participate(model, context, progress, token);
373
373
  }
374
374
  canDispose(model) {
375
375
  if (model.isDisposed() ||
@@ -1,18 +1,12 @@
1
1
  import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
2
  import { raceCancellation } from 'vscode/vscode/vs/base/common/async';
4
- import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
5
3
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
6
- import { ProgressLocation } from 'vscode/vscode/vs/platform/progress/common/progress';
7
- import { IProgressService } from 'vscode/vscode/vs/platform/progress/common/progress.service';
8
4
  import { Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
9
5
  import { insert } from 'vscode/vscode/vs/base/common/arrays';
10
6
 
11
- const _moduleId = "vs/workbench/services/textfile/common/textFileSaveParticipant";
12
7
  let TextFileSaveParticipant = class TextFileSaveParticipant extends Disposable {
13
- constructor(progressService, logService) {
8
+ constructor(logService) {
14
9
  super();
15
- this.progressService = progressService;
16
10
  this.logService = logService;
17
11
  this.saveParticipants = [];
18
12
  }
@@ -20,42 +14,29 @@ let TextFileSaveParticipant = class TextFileSaveParticipant extends Disposable {
20
14
  const remove = insert(this.saveParticipants, participant);
21
15
  return toDisposable(() => remove());
22
16
  }
23
- participate(model, context, token) {
24
- const cts = ( (new CancellationTokenSource(token)));
25
- return this.progressService.withProgress({
26
- title: ( localizeWithPath(_moduleId, 0, "Saving '{0}'", model.name)),
27
- location: ProgressLocation.Notification,
28
- cancellable: true,
29
- delay: model.isDirty() ? 3000 : 5000
30
- }, async (progress) => {
31
- model.textEditorModel?.pushStackElement();
32
- for (const saveParticipant of this.saveParticipants) {
33
- if (cts.token.isCancellationRequested || !model.textEditorModel ) {
34
- break;
35
- }
36
- try {
37
- const promise = saveParticipant.participate(model, context, progress, cts.token);
38
- await raceCancellation(promise, cts.token);
39
- }
40
- catch (err) {
41
- this.logService.error(err);
42
- }
17
+ async participate(model, context, progress, token) {
18
+ model.textEditorModel?.pushStackElement();
19
+ for (const saveParticipant of this.saveParticipants) {
20
+ if (token.isCancellationRequested || !model.textEditorModel ) {
21
+ break;
43
22
  }
44
- model.textEditorModel?.pushStackElement();
45
- }, () => {
46
- cts.cancel();
47
- }).finally(() => {
48
- cts.dispose();
49
- });
23
+ try {
24
+ const promise = saveParticipant.participate(model, context, progress, token);
25
+ await raceCancellation(promise, token);
26
+ }
27
+ catch (err) {
28
+ this.logService.error(err);
29
+ }
30
+ }
31
+ model.textEditorModel?.pushStackElement();
50
32
  }
51
33
  dispose() {
52
34
  this.saveParticipants.splice(0, this.saveParticipants.length);
53
35
  super.dispose();
54
36
  }
55
37
  };
56
- TextFileSaveParticipant = ( (__decorate([
57
- ( (__param(0, IProgressService))),
58
- ( (__param(1, ILogService)))
59
- ], TextFileSaveParticipant)));
38
+ TextFileSaveParticipant = ( __decorate([
39
+ ( __param(0, ILogService))
40
+ ], TextFileSaveParticipant));
60
41
 
61
42
  export { TextFileSaveParticipant };