@codingame/monaco-vscode-files-service-override 4.5.0 → 4.5.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/files.js +3 -40
- package/index.d.ts +2 -6
- package/package.json +2 -2
- package/vscode/src/vs/platform/files/browser/indexedDBFileSystemProvider.js +40 -57
- package/vscode/src/vs/platform/files/common/fileService.js +292 -141
- package/vscode/src/vs/platform/files/common/io.js +2 -1
- package/vscode/src/vs/workbench/services/files/browser/elevatedFileService.js +1 -1
- package/vscode/src/vs/workbench/services/textfile/browser/textFileService.js +51 -82
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModelManager.js +38 -35
- package/vscode/src/vs/workbench/services/textfile/common/textFileSaveParticipant.js +7 -11
- package/files.d.ts +0 -161
- package/vscode/src/vs/base/browser/indexedDB.d.ts +0 -17
- package/vscode/src/vs/platform/files/browser/htmlFileSystemProvider.d.ts +0 -43
- package/vscode/src/vs/platform/files/browser/indexedDBFileSystemProvider.d.ts +0 -48
- package/vscode/src/vs/platform/files/common/inMemoryFilesystemProvider.d.ts +0 -59
|
@@ -3,6 +3,7 @@ import { canceled } from 'vscode/vscode/vs/base/common/errors';
|
|
|
3
3
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
4
4
|
import { ensureFileSystemProviderError, createFileSystemProviderError, FileSystemProviderErrorCode } from 'vscode/vscode/vs/platform/files/common/files';
|
|
5
5
|
|
|
6
|
+
const _moduleId = "vs/platform/files/common/io";
|
|
6
7
|
async function readFileIntoStream(provider, resource, target, transformer, options, token) {
|
|
7
8
|
let error = undefined;
|
|
8
9
|
try {
|
|
@@ -69,7 +70,7 @@ function throwIfCancelled(token) {
|
|
|
69
70
|
}
|
|
70
71
|
function throwIfTooLarge(totalBytesRead, options) {
|
|
71
72
|
if (typeof options?.limits?.size === 'number' && totalBytesRead > options.limits.size) {
|
|
72
|
-
throw createFileSystemProviderError(localizeWithPath(
|
|
73
|
+
throw createFileSystemProviderError(localizeWithPath(_moduleId, 0, "File is too large to open"), FileSystemProviderErrorCode.FileTooLarge);
|
|
73
74
|
}
|
|
74
75
|
return true;
|
|
75
76
|
}
|
|
@@ -50,18 +50,11 @@ import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
|
50
50
|
import { firstOrDefault } from 'vscode/vscode/vs/base/common/arrays';
|
|
51
51
|
|
|
52
52
|
var AbstractTextFileService_1;
|
|
53
|
+
const _moduleId = "vs/workbench/services/textfile/browser/textFileService";
|
|
53
54
|
let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
54
55
|
static { AbstractTextFileService_1 = this; }
|
|
55
|
-
static { this.TEXTFILE_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource('textFileCreate.source', ( localizeWithPath(
|
|
56
|
-
|
|
57
|
-
'textFileCreate.source',
|
|
58
|
-
"File Created"
|
|
59
|
-
))); }
|
|
60
|
-
static { this.TEXTFILE_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource('textFileOverwrite.source', ( localizeWithPath(
|
|
61
|
-
'vs/workbench/services/textfile/browser/textFileService',
|
|
62
|
-
'textFileOverwrite.source',
|
|
63
|
-
"File Replaced"
|
|
64
|
-
))); }
|
|
56
|
+
static { this.TEXTFILE_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource('textFileCreate.source', ( localizeWithPath(_moduleId, 0, "File Created"))); }
|
|
57
|
+
static { this.TEXTFILE_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource('textFileOverwrite.source', ( localizeWithPath(_moduleId, 1, "File Replaced"))); }
|
|
65
58
|
constructor(fileService, untitledTextEditorService, lifecycleService, instantiationService, modelService, environmentService, dialogService, fileDialogService, textResourceConfigurationService, filesConfigurationService, codeEditorService, pathService, workingCopyFileService, uriIdentityService, languageService, logService, elevatedFileService, decorationsService) {
|
|
66
59
|
super();
|
|
67
60
|
this.fileService = fileService;
|
|
@@ -91,12 +84,8 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
91
84
|
constructor(files) {
|
|
92
85
|
super();
|
|
93
86
|
this.files = files;
|
|
94
|
-
this.label = ( localizeWithPath(
|
|
95
|
-
|
|
96
|
-
'textFileModelDecorations',
|
|
97
|
-
"Text File Model Decorations"
|
|
98
|
-
));
|
|
99
|
-
this._onDidChange = this._register(( new Emitter()));
|
|
87
|
+
this.label = ( localizeWithPath(_moduleId, 2, "Text File Model Decorations"));
|
|
88
|
+
this._onDidChange = this._register(( (new Emitter())));
|
|
100
89
|
this.onDidChange = this._onDidChange.event;
|
|
101
90
|
this.registerListeners();
|
|
102
91
|
}
|
|
@@ -122,32 +111,20 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
122
111
|
color: listErrorForeground,
|
|
123
112
|
letter: Codicon.lockSmall,
|
|
124
113
|
strikethrough: true,
|
|
125
|
-
tooltip: ( localizeWithPath(
|
|
126
|
-
'vs/workbench/services/textfile/browser/textFileService',
|
|
127
|
-
'readonlyAndDeleted',
|
|
128
|
-
"Deleted, Read-only"
|
|
129
|
-
)),
|
|
114
|
+
tooltip: ( localizeWithPath(_moduleId, 3, "Deleted, Read-only")),
|
|
130
115
|
};
|
|
131
116
|
}
|
|
132
117
|
else if (isReadonly) {
|
|
133
118
|
return {
|
|
134
119
|
letter: Codicon.lockSmall,
|
|
135
|
-
tooltip: ( localizeWithPath(
|
|
136
|
-
'vs/workbench/services/textfile/browser/textFileService',
|
|
137
|
-
'readonly',
|
|
138
|
-
"Read-only"
|
|
139
|
-
)),
|
|
120
|
+
tooltip: ( localizeWithPath(_moduleId, 4, "Read-only")),
|
|
140
121
|
};
|
|
141
122
|
}
|
|
142
123
|
else if (isOrphaned) {
|
|
143
124
|
return {
|
|
144
125
|
color: listErrorForeground,
|
|
145
126
|
strikethrough: true,
|
|
146
|
-
tooltip: ( localizeWithPath(
|
|
147
|
-
'vs/workbench/services/textfile/browser/textFileService',
|
|
148
|
-
'deleted',
|
|
149
|
-
"Deleted"
|
|
150
|
-
)),
|
|
127
|
+
tooltip: ( localizeWithPath(_moduleId, 5, "Deleted")),
|
|
151
128
|
};
|
|
152
129
|
}
|
|
153
130
|
return undefined;
|
|
@@ -181,7 +158,7 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
181
158
|
};
|
|
182
159
|
}
|
|
183
160
|
async doRead(resource, options) {
|
|
184
|
-
const cts = ( new CancellationTokenSource());
|
|
161
|
+
const cts = ( (new CancellationTokenSource()));
|
|
185
162
|
let bufferStream;
|
|
186
163
|
if (options?.preferUnbuffered) {
|
|
187
164
|
const content = await this.fileService.readFile(resource, options, cts.token);
|
|
@@ -200,7 +177,11 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
200
177
|
catch (error) {
|
|
201
178
|
cts.dispose(true);
|
|
202
179
|
if (error.decodeStreamErrorKind === 1 ) {
|
|
203
|
-
throw new TextFileOperationError(
|
|
180
|
+
throw ( (new TextFileOperationError(
|
|
181
|
+
localizeWithPath(_moduleId, 6, "File seems to be binary and cannot be opened as text"),
|
|
182
|
+
0 ,
|
|
183
|
+
options
|
|
184
|
+
)));
|
|
204
185
|
}
|
|
205
186
|
else {
|
|
206
187
|
throw error;
|
|
@@ -208,14 +189,14 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
208
189
|
}
|
|
209
190
|
}
|
|
210
191
|
async create(operations, undoInfo) {
|
|
211
|
-
const operationsWithContents = await Promise.all(( operations.map(async (operation) => {
|
|
192
|
+
const operationsWithContents = await Promise.all(( (operations.map(async (operation) => {
|
|
212
193
|
const contents = await this.getEncodedReadable(operation.resource, operation.value);
|
|
213
194
|
return {
|
|
214
195
|
resource: operation.resource,
|
|
215
196
|
contents,
|
|
216
197
|
overwrite: operation.options?.overwrite
|
|
217
198
|
};
|
|
218
|
-
})));
|
|
199
|
+
}))));
|
|
219
200
|
return this.workingCopyFileService.create(operationsWithContents, CancellationToken.None, undoInfo);
|
|
220
201
|
}
|
|
221
202
|
async write(resource, value, options) {
|
|
@@ -412,23 +393,19 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
412
393
|
const { confirmed } = await this.dialogService.confirm({
|
|
413
394
|
type: 'warning',
|
|
414
395
|
message: ( localizeWithPath(
|
|
415
|
-
|
|
416
|
-
|
|
396
|
+
_moduleId,
|
|
397
|
+
7,
|
|
417
398
|
"'{0}' already exists. Do you want to replace it?",
|
|
418
399
|
basename(resource)
|
|
419
400
|
)),
|
|
420
401
|
detail: ( localizeWithPath(
|
|
421
|
-
|
|
422
|
-
|
|
402
|
+
_moduleId,
|
|
403
|
+
8,
|
|
423
404
|
"A file or folder with the name '{0}' already exists in the folder '{1}'. Replacing it will overwrite its current contents.",
|
|
424
405
|
basename(resource),
|
|
425
406
|
basename(dirname(resource))
|
|
426
407
|
)),
|
|
427
|
-
primaryButton: ( localizeWithPath(
|
|
428
|
-
'vs/workbench/services/textfile/browser/textFileService',
|
|
429
|
-
{ key: 'replaceButtonLabel', comment: ['&& denotes a mnemonic'] },
|
|
430
|
-
"&&Replace"
|
|
431
|
-
)),
|
|
408
|
+
primaryButton: ( localizeWithPath(_moduleId, 9, "&&Replace")),
|
|
432
409
|
});
|
|
433
410
|
return confirmed;
|
|
434
411
|
}
|
|
@@ -436,21 +413,13 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
436
413
|
const { confirmed } = await this.dialogService.confirm({
|
|
437
414
|
type: 'warning',
|
|
438
415
|
message: ( localizeWithPath(
|
|
439
|
-
|
|
440
|
-
|
|
416
|
+
_moduleId,
|
|
417
|
+
10,
|
|
441
418
|
"'{0}' is marked as read-only. Do you want to save anyway?",
|
|
442
419
|
basename(resource)
|
|
443
420
|
)),
|
|
444
|
-
detail: ( localizeWithPath(
|
|
445
|
-
|
|
446
|
-
'confirmMakeWriteableDetail',
|
|
447
|
-
"Paths can be configured as read-only via settings."
|
|
448
|
-
)),
|
|
449
|
-
primaryButton: ( localizeWithPath(
|
|
450
|
-
'vs/workbench/services/textfile/browser/textFileService',
|
|
451
|
-
{ key: 'makeWriteableButtonLabel', comment: ['&& denotes a mnemonic'] },
|
|
452
|
-
"&&Save Anyway"
|
|
453
|
-
))
|
|
421
|
+
detail: ( localizeWithPath(_moduleId, 11, "Paths can be configured as read-only via settings.")),
|
|
422
|
+
primaryButton: ( localizeWithPath(_moduleId, 12, "&&Save Anyway"))
|
|
454
423
|
});
|
|
455
424
|
return confirmed;
|
|
456
425
|
}
|
|
@@ -533,26 +502,26 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
533
502
|
return false;
|
|
534
503
|
}
|
|
535
504
|
};
|
|
536
|
-
AbstractTextFileService = AbstractTextFileService_1 = ( __decorate([
|
|
537
|
-
( __param(0, IFileService)),
|
|
538
|
-
( __param(1, IUntitledTextEditorService)),
|
|
539
|
-
( __param(2, ILifecycleService)),
|
|
540
|
-
( __param(3, IInstantiationService)),
|
|
541
|
-
( __param(4, IModelService)),
|
|
542
|
-
( __param(5, IWorkbenchEnvironmentService)),
|
|
543
|
-
( __param(6, IDialogService)),
|
|
544
|
-
( __param(7, IFileDialogService)),
|
|
545
|
-
( __param(8, ITextResourceConfigurationService)),
|
|
546
|
-
( __param(9, IFilesConfigurationService)),
|
|
547
|
-
( __param(10, ICodeEditorService)),
|
|
548
|
-
( __param(11, IPathService)),
|
|
549
|
-
( __param(12, IWorkingCopyFileService)),
|
|
550
|
-
( __param(13, IUriIdentityService)),
|
|
551
|
-
( __param(14, ILanguageService)),
|
|
552
|
-
( __param(15, ILogService)),
|
|
553
|
-
( __param(16, IElevatedFileService)),
|
|
554
|
-
( __param(17, IDecorationsService))
|
|
555
|
-
], AbstractTextFileService));
|
|
505
|
+
AbstractTextFileService = AbstractTextFileService_1 = ( (__decorate([
|
|
506
|
+
( (__param(0, IFileService))),
|
|
507
|
+
( (__param(1, IUntitledTextEditorService))),
|
|
508
|
+
( (__param(2, ILifecycleService))),
|
|
509
|
+
( (__param(3, IInstantiationService))),
|
|
510
|
+
( (__param(4, IModelService))),
|
|
511
|
+
( (__param(5, IWorkbenchEnvironmentService))),
|
|
512
|
+
( (__param(6, IDialogService))),
|
|
513
|
+
( (__param(7, IFileDialogService))),
|
|
514
|
+
( (__param(8, ITextResourceConfigurationService))),
|
|
515
|
+
( (__param(9, IFilesConfigurationService))),
|
|
516
|
+
( (__param(10, ICodeEditorService))),
|
|
517
|
+
( (__param(11, IPathService))),
|
|
518
|
+
( (__param(12, IWorkingCopyFileService))),
|
|
519
|
+
( (__param(13, IUriIdentityService))),
|
|
520
|
+
( (__param(14, ILanguageService))),
|
|
521
|
+
( (__param(15, ILogService))),
|
|
522
|
+
( (__param(16, IElevatedFileService))),
|
|
523
|
+
( (__param(17, IDecorationsService)))
|
|
524
|
+
], AbstractTextFileService)));
|
|
556
525
|
let EncodingOracle = class EncodingOracle extends Disposable {
|
|
557
526
|
get encodingOverrides() { return this._encodingOverrides; }
|
|
558
527
|
set encodingOverrides(value) { this._encodingOverrides = value; }
|
|
@@ -644,11 +613,11 @@ let EncodingOracle = class EncodingOracle extends Disposable {
|
|
|
644
613
|
return undefined;
|
|
645
614
|
}
|
|
646
615
|
};
|
|
647
|
-
EncodingOracle = ( __decorate([
|
|
648
|
-
( __param(0, ITextResourceConfigurationService)),
|
|
649
|
-
( __param(1, IWorkbenchEnvironmentService)),
|
|
650
|
-
( __param(2, IWorkspaceContextService)),
|
|
651
|
-
( __param(3, IUriIdentityService))
|
|
652
|
-
], EncodingOracle));
|
|
616
|
+
EncodingOracle = ( (__decorate([
|
|
617
|
+
( (__param(0, ITextResourceConfigurationService))),
|
|
618
|
+
( (__param(1, IWorkbenchEnvironmentService))),
|
|
619
|
+
( (__param(2, IWorkspaceContextService))),
|
|
620
|
+
( (__param(3, IUriIdentityService)))
|
|
621
|
+
], EncodingOracle)));
|
|
653
622
|
|
|
654
623
|
export { AbstractTextFileService, EncodingOracle };
|
|
@@ -18,9 +18,10 @@ import { createTextBufferFactoryFromSnapshot } from 'vscode/vscode/vs/editor/com
|
|
|
18
18
|
import { PLAINTEXT_LANGUAGE_ID, PLAINTEXT_EXTENSION } from 'vscode/vscode/vs/editor/common/languages/modesRegistry';
|
|
19
19
|
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
20
20
|
|
|
21
|
+
const _moduleId = "vs/workbench/services/textfile/common/textFileEditorModelManager";
|
|
21
22
|
let TextFileEditorModelManager = class TextFileEditorModelManager extends Disposable {
|
|
22
23
|
get models() {
|
|
23
|
-
return [...( this.mapResourceToModel.values())];
|
|
24
|
+
return [...( (this.mapResourceToModel.values()))];
|
|
24
25
|
}
|
|
25
26
|
constructor(instantiationService, fileService, notificationService, workingCopyFileService, uriIdentityService) {
|
|
26
27
|
super();
|
|
@@ -29,38 +30,38 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
29
30
|
this.notificationService = notificationService;
|
|
30
31
|
this.workingCopyFileService = workingCopyFileService;
|
|
31
32
|
this.uriIdentityService = uriIdentityService;
|
|
32
|
-
this._onDidCreate = this._register(( new Emitter()));
|
|
33
|
+
this._onDidCreate = this._register(( (new Emitter())));
|
|
33
34
|
this.onDidCreate = this._onDidCreate.event;
|
|
34
|
-
this._onDidResolve = this._register(( new Emitter()));
|
|
35
|
+
this._onDidResolve = this._register(( (new Emitter())));
|
|
35
36
|
this.onDidResolve = this._onDidResolve.event;
|
|
36
|
-
this._onDidRemove = this._register(( new Emitter()));
|
|
37
|
+
this._onDidRemove = this._register(( (new Emitter())));
|
|
37
38
|
this.onDidRemove = this._onDidRemove.event;
|
|
38
|
-
this._onDidChangeDirty = this._register(( new Emitter()));
|
|
39
|
+
this._onDidChangeDirty = this._register(( (new Emitter())));
|
|
39
40
|
this.onDidChangeDirty = this._onDidChangeDirty.event;
|
|
40
|
-
this._onDidChangeReadonly = this._register(( new Emitter()));
|
|
41
|
+
this._onDidChangeReadonly = this._register(( (new Emitter())));
|
|
41
42
|
this.onDidChangeReadonly = this._onDidChangeReadonly.event;
|
|
42
|
-
this._onDidChangeOrphaned = this._register(( new Emitter()));
|
|
43
|
+
this._onDidChangeOrphaned = this._register(( (new Emitter())));
|
|
43
44
|
this.onDidChangeOrphaned = this._onDidChangeOrphaned.event;
|
|
44
|
-
this._onDidSaveError = this._register(( new Emitter()));
|
|
45
|
+
this._onDidSaveError = this._register(( (new Emitter())));
|
|
45
46
|
this.onDidSaveError = this._onDidSaveError.event;
|
|
46
|
-
this._onDidSave = this._register(( new Emitter()));
|
|
47
|
+
this._onDidSave = this._register(( (new Emitter())));
|
|
47
48
|
this.onDidSave = this._onDidSave.event;
|
|
48
|
-
this._onDidRevert = this._register(( new Emitter()));
|
|
49
|
+
this._onDidRevert = this._register(( (new Emitter())));
|
|
49
50
|
this.onDidRevert = this._onDidRevert.event;
|
|
50
|
-
this._onDidChangeEncoding = this._register(( new Emitter()));
|
|
51
|
+
this._onDidChangeEncoding = this._register(( (new Emitter())));
|
|
51
52
|
this.onDidChangeEncoding = this._onDidChangeEncoding.event;
|
|
52
|
-
this.mapResourceToModel = ( new ResourceMap());
|
|
53
|
-
this.mapResourceToModelListeners = ( new ResourceMap());
|
|
54
|
-
this.mapResourceToDisposeListener = ( new ResourceMap());
|
|
55
|
-
this.mapResourceToPendingModelResolvers = ( new ResourceMap());
|
|
56
|
-
this.modelResolveQueue = this._register(( new ResourceQueue()));
|
|
53
|
+
this.mapResourceToModel = ( (new ResourceMap()));
|
|
54
|
+
this.mapResourceToModelListeners = ( (new ResourceMap()));
|
|
55
|
+
this.mapResourceToDisposeListener = ( (new ResourceMap()));
|
|
56
|
+
this.mapResourceToPendingModelResolvers = ( (new ResourceMap()));
|
|
57
|
+
this.modelResolveQueue = this._register(( (new ResourceQueue())));
|
|
57
58
|
this.saveErrorHandler = (() => {
|
|
58
59
|
const notificationService = this.notificationService;
|
|
59
60
|
return {
|
|
60
61
|
onSaveError(error, model) {
|
|
61
62
|
notificationService.error(( localizeWithPath(
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
_moduleId,
|
|
64
|
+
0,
|
|
64
65
|
"Failed to save '{0}': {1}",
|
|
65
66
|
model.name,
|
|
66
67
|
toErrorMessage(error, false)
|
|
@@ -68,7 +69,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
68
69
|
}
|
|
69
70
|
};
|
|
70
71
|
})();
|
|
71
|
-
this.mapCorrelationIdToModelsToRestore = ( new Map());
|
|
72
|
+
this.mapCorrelationIdToModelsToRestore = ( (new Map()));
|
|
72
73
|
this.saveParticipants = this._register(this.instantiationService.createInstance(TextFileSaveParticipant));
|
|
73
74
|
this.registerListeners();
|
|
74
75
|
}
|
|
@@ -189,7 +190,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
189
190
|
const modelsToRestore = this.mapCorrelationIdToModelsToRestore.get(e.correlationId);
|
|
190
191
|
if (modelsToRestore) {
|
|
191
192
|
this.mapCorrelationIdToModelsToRestore.delete(e.correlationId);
|
|
192
|
-
await Promises.settled(( modelsToRestore.map(async (modelToRestore) => {
|
|
193
|
+
await Promises.settled(( (modelsToRestore.map(async (modelToRestore) => {
|
|
193
194
|
const restoredModel = await this.resolve(modelToRestore.target, {
|
|
194
195
|
reload: { async: false },
|
|
195
196
|
contents: modelToRestore.snapshot ? createTextBufferFactoryFromSnapshot(modelToRestore.snapshot) : undefined,
|
|
@@ -201,7 +202,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
201
202
|
extname(modelToRestore.target) !== PLAINTEXT_EXTENSION) {
|
|
202
203
|
restoredModel.updateTextEditorModel(undefined, modelToRestore.languageId);
|
|
203
204
|
}
|
|
204
|
-
})));
|
|
205
|
+
}))));
|
|
205
206
|
}
|
|
206
207
|
})());
|
|
207
208
|
break;
|
|
@@ -211,11 +212,13 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
211
212
|
return this.mapResourceToModel.get(resource);
|
|
212
213
|
}
|
|
213
214
|
has(resource) {
|
|
214
|
-
return (
|
|
215
|
+
return (
|
|
216
|
+
(this.mapResourceToModel.has(resource))
|
|
217
|
+
);
|
|
215
218
|
}
|
|
216
219
|
async reload(model) {
|
|
217
220
|
await this.joinPendingResolves(model.resource);
|
|
218
|
-
if (model.isDirty() || model.isDisposed() || !( this.has(model.resource))) {
|
|
221
|
+
if (model.isDirty() || model.isDisposed() || !( (this.has(model.resource)))) {
|
|
219
222
|
return;
|
|
220
223
|
}
|
|
221
224
|
await this.doResolve(model, { reload: { async: false } });
|
|
@@ -307,7 +310,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
307
310
|
}
|
|
308
311
|
async doJoinPendingResolves(resource) {
|
|
309
312
|
let currentModelCopyResolve;
|
|
310
|
-
while (( this.mapResourceToPendingModelResolvers.has(resource))) {
|
|
313
|
+
while (( (this.mapResourceToPendingModelResolvers.has(resource)))) {
|
|
311
314
|
const nextPendingModelResolve = this.mapResourceToPendingModelResolvers.get(resource);
|
|
312
315
|
if (nextPendingModelResolve === currentModelCopyResolve) {
|
|
313
316
|
return;
|
|
@@ -321,7 +324,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
321
324
|
}
|
|
322
325
|
}
|
|
323
326
|
registerModel(model) {
|
|
324
|
-
const modelListeners = ( new DisposableStore());
|
|
327
|
+
const modelListeners = ( (new DisposableStore()));
|
|
325
328
|
modelListeners.add(model.onDidResolve(reason => this._onDidResolve.fire({ model, reason })));
|
|
326
329
|
modelListeners.add(model.onDidChangeDirty(() => this._onDidChangeDirty.fire(model)));
|
|
327
330
|
modelListeners.add(model.onDidChangeReadonly(() => this._onDidChangeReadonly.fire(model)));
|
|
@@ -366,7 +369,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
366
369
|
}
|
|
367
370
|
canDispose(model) {
|
|
368
371
|
if (model.isDisposed() ||
|
|
369
|
-
(!( this.mapResourceToPendingModelResolvers.has(model.resource)) && !model.isDirty())) {
|
|
372
|
+
(!( (this.mapResourceToPendingModelResolvers.has(model.resource))) && !model.isDirty())) {
|
|
370
373
|
return true;
|
|
371
374
|
}
|
|
372
375
|
return this.doCanDispose(model);
|
|
@@ -387,18 +390,18 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
387
390
|
super.dispose();
|
|
388
391
|
this.mapResourceToModel.clear();
|
|
389
392
|
this.mapResourceToPendingModelResolvers.clear();
|
|
390
|
-
dispose(( this.mapResourceToDisposeListener.values()));
|
|
393
|
+
dispose(( (this.mapResourceToDisposeListener.values())));
|
|
391
394
|
this.mapResourceToDisposeListener.clear();
|
|
392
|
-
dispose(( this.mapResourceToModelListeners.values()));
|
|
395
|
+
dispose(( (this.mapResourceToModelListeners.values())));
|
|
393
396
|
this.mapResourceToModelListeners.clear();
|
|
394
397
|
}
|
|
395
398
|
};
|
|
396
|
-
TextFileEditorModelManager = ( __decorate([
|
|
397
|
-
( __param(0, IInstantiationService)),
|
|
398
|
-
( __param(1, IFileService)),
|
|
399
|
-
( __param(2, INotificationService)),
|
|
400
|
-
( __param(3, IWorkingCopyFileService)),
|
|
401
|
-
( __param(4, IUriIdentityService))
|
|
402
|
-
], TextFileEditorModelManager));
|
|
399
|
+
TextFileEditorModelManager = ( (__decorate([
|
|
400
|
+
( (__param(0, IInstantiationService))),
|
|
401
|
+
( (__param(1, IFileService))),
|
|
402
|
+
( (__param(2, INotificationService))),
|
|
403
|
+
( (__param(3, IWorkingCopyFileService))),
|
|
404
|
+
( (__param(4, IUriIdentityService)))
|
|
405
|
+
], TextFileEditorModelManager)));
|
|
403
406
|
|
|
404
407
|
export { TextFileEditorModelManager };
|
|
@@ -7,6 +7,7 @@ import { IProgressService } from 'vscode/vscode/vs/platform/progress/common/prog
|
|
|
7
7
|
import { Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
8
8
|
import { insert } from 'vscode/vscode/vs/base/common/arrays';
|
|
9
9
|
|
|
10
|
+
const _moduleId = "vs/workbench/services/textfile/common/textFileSaveParticipant";
|
|
10
11
|
let TextFileSaveParticipant = class TextFileSaveParticipant extends Disposable {
|
|
11
12
|
constructor(progressService, logService) {
|
|
12
13
|
super();
|
|
@@ -19,14 +20,9 @@ let TextFileSaveParticipant = class TextFileSaveParticipant extends Disposable {
|
|
|
19
20
|
return toDisposable(() => remove());
|
|
20
21
|
}
|
|
21
22
|
participate(model, context, token) {
|
|
22
|
-
const cts = ( new CancellationTokenSource(token));
|
|
23
|
+
const cts = ( (new CancellationTokenSource(token)));
|
|
23
24
|
return this.progressService.withProgress({
|
|
24
|
-
title: ( localizeWithPath(
|
|
25
|
-
'vs/workbench/services/textfile/common/textFileSaveParticipant',
|
|
26
|
-
'saveParticipants',
|
|
27
|
-
"Saving '{0}'",
|
|
28
|
-
model.name
|
|
29
|
-
)),
|
|
25
|
+
title: ( localizeWithPath(_moduleId, 0, "Saving '{0}'", model.name)),
|
|
30
26
|
location: 15 ,
|
|
31
27
|
cancellable: true,
|
|
32
28
|
delay: model.isDirty() ? 3000 : 5000
|
|
@@ -56,9 +52,9 @@ let TextFileSaveParticipant = class TextFileSaveParticipant extends Disposable {
|
|
|
56
52
|
super.dispose();
|
|
57
53
|
}
|
|
58
54
|
};
|
|
59
|
-
TextFileSaveParticipant = ( __decorate([
|
|
60
|
-
( __param(0, IProgressService)),
|
|
61
|
-
( __param(1, ILogService))
|
|
62
|
-
], TextFileSaveParticipant));
|
|
55
|
+
TextFileSaveParticipant = ( (__decorate([
|
|
56
|
+
( (__param(0, IProgressService))),
|
|
57
|
+
( (__param(1, ILogService)))
|
|
58
|
+
], TextFileSaveParticipant)));
|
|
63
59
|
|
|
64
60
|
export { TextFileSaveParticipant };
|
package/files.d.ts
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { IEditorOverrideServices } from 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
|
|
2
|
-
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
3
|
-
import { Disposable, IDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
5
|
-
import { FileType, IStat, IFileSystemProviderWithFileReadWriteCapability, IFileChange, IWatchOptions, IFileWriteOptions, IFileDeleteOptions, IFileOverwriteOptions, IFileSystemProvider, FileSystemProviderCapabilities, FileChangeType } from 'vscode/vscode/vs/platform/files/common/files';
|
|
6
|
-
export { FileChangeType, FilePermission, FileSystemProviderCapabilities, FileSystemProviderError, FileSystemProviderErrorCode, FileType, IFileChange, IFileDeleteOptions, IFileOverwriteOptions, IFileSystemProviderWithFileReadWriteCapability, IFileWriteOptions, IStat, IWatchOptions } from 'vscode/vscode/vs/platform/files/common/files';
|
|
7
|
-
import { IndexedDBFileSystemProvider } from './vscode/src/vs/platform/files/browser/indexedDBFileSystemProvider.js';
|
|
8
|
-
|
|
9
|
-
declare abstract class RegisteredFile {
|
|
10
|
-
uri: URI;
|
|
11
|
-
private readonly;
|
|
12
|
-
protected ctime: number;
|
|
13
|
-
protected mtime: number;
|
|
14
|
-
readonly type: FileType;
|
|
15
|
-
protected _onDidChange: Emitter<void>;
|
|
16
|
-
onDidChange: Event<void>;
|
|
17
|
-
protected _onDidDelete: Emitter<void>;
|
|
18
|
-
onDidDelete: Event<void>;
|
|
19
|
-
protected _onDidRename: Emitter<{
|
|
20
|
-
from: URI;
|
|
21
|
-
to: URI;
|
|
22
|
-
}>;
|
|
23
|
-
onDidRename: Event<{
|
|
24
|
-
from: URI;
|
|
25
|
-
to: URI;
|
|
26
|
-
}>;
|
|
27
|
-
constructor(uri: URI, readonly: boolean);
|
|
28
|
-
stats(): Promise<IStat>;
|
|
29
|
-
getSize(): Promise<number>;
|
|
30
|
-
abstract read(): Promise<string | Uint8Array>;
|
|
31
|
-
abstract write(content: string): Promise<void>;
|
|
32
|
-
delete(): Promise<void>;
|
|
33
|
-
rename(to: URI): Promise<void>;
|
|
34
|
-
}
|
|
35
|
-
declare class RegisteredReadOnlyFile extends RegisteredFile {
|
|
36
|
-
read: () => Promise<string | Uint8Array>;
|
|
37
|
-
constructor(uri: URI, read: () => Promise<string | Uint8Array>);
|
|
38
|
-
write(): Promise<void>;
|
|
39
|
-
delete(): Promise<void>;
|
|
40
|
-
rename(): Promise<void>;
|
|
41
|
-
}
|
|
42
|
-
declare class RegisteredMemoryFile extends RegisteredFile {
|
|
43
|
-
private content;
|
|
44
|
-
constructor(uri: URI, content: string);
|
|
45
|
-
read(): Promise<string | Uint8Array>;
|
|
46
|
-
write(content: string): Promise<void>;
|
|
47
|
-
}
|
|
48
|
-
declare class RegisteredFileSystemProvider extends Disposable implements IFileSystemProviderWithFileReadWriteCapability {
|
|
49
|
-
private files;
|
|
50
|
-
capabilities: number;
|
|
51
|
-
constructor(readonly: boolean);
|
|
52
|
-
onDidChangeCapabilities: Event<any>;
|
|
53
|
-
_onDidChangeFile: Emitter<readonly IFileChange[]>;
|
|
54
|
-
onDidChangeFile: Event<readonly IFileChange[]>;
|
|
55
|
-
registerFile(file: RegisteredFile): IDisposable;
|
|
56
|
-
stat(resource: URI): Promise<IStat>;
|
|
57
|
-
readdir(resource: URI): Promise<[string, FileType][]>;
|
|
58
|
-
readFile(resource: URI): Promise<Uint8Array>;
|
|
59
|
-
watch(): IDisposable;
|
|
60
|
-
writeFile(resource: URI, content: Uint8Array): Promise<void>;
|
|
61
|
-
delete(resource: URI): Promise<void>;
|
|
62
|
-
rename(from: URI, to: URI): Promise<void>;
|
|
63
|
-
mkdir(): Promise<never>;
|
|
64
|
-
}
|
|
65
|
-
declare class OverlayFileSystemProvider implements IFileSystemProviderWithFileReadWriteCapability {
|
|
66
|
-
private providers;
|
|
67
|
-
register(priority: number, provider: IFileSystemProviderWithFileReadWriteCapability): IDisposable;
|
|
68
|
-
get delegates(): IFileSystemProviderWithFileReadWriteCapability[];
|
|
69
|
-
onDidChangeCapabilities: Event<any>;
|
|
70
|
-
_onDidChangeFile: Emitter<readonly IFileChange[]>;
|
|
71
|
-
onDidChangeFile: Event<readonly IFileChange[]>;
|
|
72
|
-
_onDidChangeOverlays: Emitter<void>;
|
|
73
|
-
onDidChangeOverlays: Event<void>;
|
|
74
|
-
capabilities: number;
|
|
75
|
-
private readFromDelegates;
|
|
76
|
-
private writeToDelegates;
|
|
77
|
-
stat(resource: URI): Promise<IStat>;
|
|
78
|
-
readFile(resource: URI): Promise<Uint8Array>;
|
|
79
|
-
readdir(resource: URI): Promise<[string, FileType][]>;
|
|
80
|
-
watch(resource: URI, opts: IWatchOptions): IDisposable;
|
|
81
|
-
writeFile(resource: URI, content: Uint8Array, opts: IFileWriteOptions): Promise<void>;
|
|
82
|
-
mkdir(resource: URI): Promise<void>;
|
|
83
|
-
delete(resource: URI, opts: IFileDeleteOptions): Promise<void>;
|
|
84
|
-
rename(from: URI, to: URI, opts: IFileOverwriteOptions): Promise<void>;
|
|
85
|
-
}
|
|
86
|
-
declare class DelegateFileSystemProvider implements IFileSystemProvider {
|
|
87
|
-
private options;
|
|
88
|
-
constructor(options: {
|
|
89
|
-
delegate: IFileSystemProvider;
|
|
90
|
-
toDelegate: (uri: URI) => URI;
|
|
91
|
-
fromDeletate: (uri: URI) => URI;
|
|
92
|
-
});
|
|
93
|
-
get capabilities(): FileSystemProviderCapabilities;
|
|
94
|
-
onDidChangeCapabilities: Event<void>;
|
|
95
|
-
onDidChangeFile: Event<{
|
|
96
|
-
type: FileChangeType;
|
|
97
|
-
resource: URI;
|
|
98
|
-
}[]>;
|
|
99
|
-
readFile: ((resource: URI) => Promise<Uint8Array>) | undefined;
|
|
100
|
-
writeFile: ((resource: URI, content: Uint8Array, opts: IFileWriteOptions) => Promise<void>) | undefined;
|
|
101
|
-
watch(resource: URI, opts: IWatchOptions): IDisposable;
|
|
102
|
-
stat(resource: URI): Promise<IStat>;
|
|
103
|
-
mkdir(resource: URI): Promise<void>;
|
|
104
|
-
readdir(resource: URI): Promise<[string, FileType][]>;
|
|
105
|
-
delete(resource: URI, opts: IFileDeleteOptions): Promise<void>;
|
|
106
|
-
rename(from: URI, to: URI, opts: IFileOverwriteOptions): Promise<void>;
|
|
107
|
-
}
|
|
108
|
-
declare class EmptyFileSystemProvider implements IFileSystemProviderWithFileReadWriteCapability {
|
|
109
|
-
readFile(): Promise<Uint8Array>;
|
|
110
|
-
writeFile(): Promise<void>;
|
|
111
|
-
capabilities: number;
|
|
112
|
-
onDidChangeCapabilities: Event<any>;
|
|
113
|
-
onDidChangeFile: Event<any>;
|
|
114
|
-
watch(): IDisposable;
|
|
115
|
-
stat(): Promise<IStat>;
|
|
116
|
-
mkdir(): Promise<void>;
|
|
117
|
-
readdir(): Promise<[string, FileType][]>;
|
|
118
|
-
delete(): Promise<void>;
|
|
119
|
-
rename(): Promise<void>;
|
|
120
|
-
}
|
|
121
|
-
declare namespace CustomSchemas {
|
|
122
|
-
/**
|
|
123
|
-
* A schema that is used for models that exist in memory
|
|
124
|
-
* only and that have no correspondence on a server or such.
|
|
125
|
-
*/
|
|
126
|
-
const extensionFile = "extension-file";
|
|
127
|
-
}
|
|
128
|
-
declare function getServiceOverride(): IEditorOverrideServices;
|
|
129
|
-
/**
|
|
130
|
-
* Register a custom file system provider for the given scheme. This allows us to override
|
|
131
|
-
* the default file system provider for a given scheme.
|
|
132
|
-
*/
|
|
133
|
-
declare function registerCustomProvider(scheme: string, provider: IFileSystemProvider): void;
|
|
134
|
-
declare function registerExtensionFile(extensionLocation: URI, filePath: string, getContent: () => Promise<string | Uint8Array>): IDisposable;
|
|
135
|
-
/**
|
|
136
|
-
* Can be used to create a file before the fileService is initialized
|
|
137
|
-
*/
|
|
138
|
-
declare function initFile(file: URI, content: Uint8Array | string, options?: Partial<IFileWriteOptions>): Promise<void>;
|
|
139
|
-
/**
|
|
140
|
-
* Can be used to replace memory providers by indexeddb providers before the fileService is initialized
|
|
141
|
-
*/
|
|
142
|
-
declare function createIndexedDBProviders(): Promise<IndexedDBFileSystemProvider>;
|
|
143
|
-
/**
|
|
144
|
-
* Can be used to replace the default filesystem provider by the HTMLFileSystemProvider before the fileService is initialized
|
|
145
|
-
* Should be called "after" createIndexedDBProviders if used
|
|
146
|
-
*/
|
|
147
|
-
declare function registerHTMLFileSystemProvider(): void;
|
|
148
|
-
/**
|
|
149
|
-
* Register a file system overlay
|
|
150
|
-
*
|
|
151
|
-
* By default, a memory filesystem is used to read and write file
|
|
152
|
-
*
|
|
153
|
-
* This method allows to register another fileSystemProvider in front OR behind the default memory one.
|
|
154
|
-
*
|
|
155
|
-
* The default one is registered as priority: 0, so:
|
|
156
|
-
* - any provider registered with a positive priority will be in front of the default one
|
|
157
|
-
* - any provider registered with a negative priority will be behind the default one
|
|
158
|
-
*/
|
|
159
|
-
declare function registerFileSystemOverlay(priority: number, provider: IFileSystemProviderWithFileReadWriteCapability): IDisposable;
|
|
160
|
-
|
|
161
|
-
export { CustomSchemas, DelegateFileSystemProvider, EmptyFileSystemProvider, IndexedDBFileSystemProvider, OverlayFileSystemProvider, RegisteredFile, RegisteredFileSystemProvider, RegisteredMemoryFile, RegisteredReadOnlyFile, createIndexedDBProviders, getServiceOverride as default, initFile, registerCustomProvider, registerExtensionFile, registerFileSystemOverlay, registerHTMLFileSystemProvider };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
declare class IndexedDB {
|
|
2
|
-
private readonly name;
|
|
3
|
-
static create(name: string, version: number | undefined, stores: string[]): Promise<IndexedDB>;
|
|
4
|
-
private static openDatabase;
|
|
5
|
-
private static doOpenDatabase;
|
|
6
|
-
private static deleteDatabase;
|
|
7
|
-
private database;
|
|
8
|
-
private readonly pendingTransactions;
|
|
9
|
-
constructor(database: IDBDatabase, name: string);
|
|
10
|
-
hasPendingTransactions(): boolean;
|
|
11
|
-
close(): void;
|
|
12
|
-
runInTransaction<T>(store: string, transactionMode: IDBTransactionMode, dbRequestFn: (store: IDBObjectStore) => IDBRequest<T>[]): Promise<T[]>;
|
|
13
|
-
runInTransaction<T>(store: string, transactionMode: IDBTransactionMode, dbRequestFn: (store: IDBObjectStore) => IDBRequest<T>): Promise<T>;
|
|
14
|
-
getKeyValues<V>(store: string, isValid: (value: unknown) => value is V): Promise<Map<string, V>>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { IndexedDB };
|