@codingame/monaco-vscode-files-service-override 37.1.0 → 37.3.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 +2 -2
- package/vscode/src/vs/platform/files/browser/indexedDBFileSystemProvider.js +27 -19
- package/vscode/src/vs/platform/files/common/fileService.js +36 -36
- package/vscode/src/vs/platform/files/common/io.js +1 -1
- package/vscode/src/vs/workbench/services/textfile/browser/textFileService.js +15 -15
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModelManager.js +3 -3
- package/vscode/src/vs/workbench/services/textfile/common/textFileSaveParticipant.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-files-service-override",
|
|
3
|
-
"version": "37.
|
|
3
|
+
"version": "37.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - files service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "37.
|
|
18
|
+
"@codingame/monaco-vscode-api": "37.3.0"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"module": "index.js",
|
|
@@ -10,13 +10,13 @@ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
|
10
10
|
import { createFileSystemProviderError, FileSystemProviderErrorCode, FileType, FileSystemProviderCapabilities, FileChangeType } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
|
|
11
11
|
import { BroadcastDataChannel } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/broadcast';
|
|
12
12
|
|
|
13
|
-
const ERR_FILE_NOT_FOUND = createFileSystemProviderError(( localize(
|
|
14
|
-
const ERR_FILE_IS_DIR = createFileSystemProviderError(( localize(
|
|
15
|
-
const ERR_FILE_NOT_DIR = createFileSystemProviderError(( localize(
|
|
16
|
-
const ERR_DIR_NOT_EMPTY = createFileSystemProviderError(( localize(
|
|
17
|
-
const ERR_FILE_EXCEEDS_STORAGE_QUOTA = createFileSystemProviderError(( localize(
|
|
13
|
+
const ERR_FILE_NOT_FOUND = createFileSystemProviderError(( localize(2321, "File does not exist")), FileSystemProviderErrorCode.FileNotFound);
|
|
14
|
+
const ERR_FILE_IS_DIR = createFileSystemProviderError(( localize(2322, "File is Directory")), FileSystemProviderErrorCode.FileIsADirectory);
|
|
15
|
+
const ERR_FILE_NOT_DIR = createFileSystemProviderError(( localize(2323, "File is not a directory")), FileSystemProviderErrorCode.FileNotADirectory);
|
|
16
|
+
const ERR_DIR_NOT_EMPTY = createFileSystemProviderError(( localize(2324, "Directory is not empty")), FileSystemProviderErrorCode.Unknown);
|
|
17
|
+
const ERR_FILE_EXCEEDS_STORAGE_QUOTA = createFileSystemProviderError(( localize(2325, "File exceeds available storage quota")), FileSystemProviderErrorCode.FileExceedsStorageQuota);
|
|
18
18
|
const ERR_UNKNOWN_INTERNAL = message => createFileSystemProviderError(( localize(
|
|
19
|
-
|
|
19
|
+
2326,
|
|
20
20
|
"Internal error occurred in IndexedDB File System Provider. ({0})",
|
|
21
21
|
message
|
|
22
22
|
)), FileSystemProviderErrorCode.Unknown);
|
|
@@ -157,10 +157,10 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
157
157
|
if (watchCrossWindowChanges) {
|
|
158
158
|
this.changesBroadcastChannel = this._register(( new BroadcastDataChannel(`vscode.indexedDB.${scheme}.changes`)));
|
|
159
159
|
this._register(this.changesBroadcastChannel.onDidReceiveData(changes => {
|
|
160
|
-
this._onDidChangeFile.fire(
|
|
160
|
+
this._onDidChangeFile.fire(changes.map(c => ({
|
|
161
161
|
type: c.type,
|
|
162
162
|
resource: URI.revive(c.resource)
|
|
163
|
-
})))
|
|
163
|
+
})));
|
|
164
164
|
}));
|
|
165
165
|
}
|
|
166
166
|
}
|
|
@@ -206,7 +206,7 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
206
206
|
if (entry.type !== FileType.Directory) {
|
|
207
207
|
throw ERR_FILE_NOT_DIR;
|
|
208
208
|
} else {
|
|
209
|
-
return
|
|
209
|
+
return [...entry.children.entries()].map(([name, node]) => [name, node.type]);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
async readFile(resource) {
|
|
@@ -279,7 +279,11 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
279
279
|
}
|
|
280
280
|
if (sourceFiles.length) {
|
|
281
281
|
const targetFiles = [];
|
|
282
|
-
const sourceFilesContents = await this.indexedDB.runInTransaction(
|
|
282
|
+
const sourceFilesContents = await this.indexedDB.runInTransaction(
|
|
283
|
+
this.store,
|
|
284
|
+
"readonly",
|
|
285
|
+
objectStore => sourceFiles.map(([path]) => objectStore.get(path))
|
|
286
|
+
);
|
|
283
287
|
for (let index = 0; index < sourceFiles.length; index++) {
|
|
284
288
|
const content = sourceFilesContents[index] instanceof Uint8Array ? sourceFilesContents[index] : isString(sourceFilesContents[index]) ? VSBuffer.fromString(sourceFilesContents[index]).buffer : undefined;
|
|
285
289
|
if (content) {
|
|
@@ -307,7 +311,7 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
307
311
|
let toDelete;
|
|
308
312
|
if (opts.recursive) {
|
|
309
313
|
const tree = await this.tree(resource);
|
|
310
|
-
toDelete =
|
|
314
|
+
toDelete = tree.map(([path]) => path);
|
|
311
315
|
} else {
|
|
312
316
|
if (stat.type === FileType.Directory && (await this.readdir(resource)).length) {
|
|
313
317
|
throw ERR_DIR_NOT_EMPTY;
|
|
@@ -317,12 +321,12 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
317
321
|
await this.deleteKeys(toDelete);
|
|
318
322
|
(await this.getFiletree()).delete(resource.path);
|
|
319
323
|
toDelete.forEach(key => this.mtimes.delete(key));
|
|
320
|
-
this.triggerChanges(
|
|
324
|
+
this.triggerChanges(toDelete.map(path => ({
|
|
321
325
|
resource: resource.with({
|
|
322
326
|
path
|
|
323
327
|
}),
|
|
324
328
|
type: FileChangeType.DELETED
|
|
325
|
-
})))
|
|
329
|
+
})));
|
|
326
330
|
}
|
|
327
331
|
async tree(resource) {
|
|
328
332
|
const stat = await this.stat(resource);
|
|
@@ -355,7 +359,7 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
355
359
|
type: FileType.Directory
|
|
356
360
|
}));
|
|
357
361
|
const result = await this.indexedDB.runInTransaction(this.store, "readonly", objectStore => objectStore.getAllKeys());
|
|
358
|
-
const keys =
|
|
362
|
+
const keys = result.map(key => ( key.toString()));
|
|
359
363
|
keys.forEach(key => rootNode.add(key, {
|
|
360
364
|
type: "file"
|
|
361
365
|
}));
|
|
@@ -378,18 +382,18 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
378
382
|
});
|
|
379
383
|
this.mtimes.set(( resource.toString()), Date.now());
|
|
380
384
|
}
|
|
381
|
-
this.triggerChanges(
|
|
385
|
+
this.triggerChanges(files.map(([resource]) => ({
|
|
382
386
|
resource,
|
|
383
387
|
type: FileChangeType.UPDATED
|
|
384
|
-
})))
|
|
388
|
+
})));
|
|
385
389
|
}
|
|
386
390
|
async writeMany() {
|
|
387
391
|
if (this.fileWriteBatch.length) {
|
|
388
392
|
const fileBatch = this.fileWriteBatch.splice(0, this.fileWriteBatch.length);
|
|
389
393
|
try {
|
|
390
|
-
await this.indexedDB.runInTransaction(this.store, "readwrite", objectStore =>
|
|
394
|
+
await this.indexedDB.runInTransaction(this.store, "readwrite", objectStore => fileBatch.map(entry => {
|
|
391
395
|
return objectStore.put(entry.content, entry.resource.path);
|
|
392
|
-
}))
|
|
396
|
+
}));
|
|
393
397
|
} catch (ex) {
|
|
394
398
|
if (ex instanceof DOMException && ex.name === "QuotaExceededError") {
|
|
395
399
|
throw ERR_FILE_EXCEEDS_STORAGE_QUOTA;
|
|
@@ -400,7 +404,11 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
400
404
|
}
|
|
401
405
|
async deleteKeys(keys) {
|
|
402
406
|
if (keys.length) {
|
|
403
|
-
await this.indexedDB.runInTransaction(
|
|
407
|
+
await this.indexedDB.runInTransaction(
|
|
408
|
+
this.store,
|
|
409
|
+
"readwrite",
|
|
410
|
+
objectStore => keys.map(key => objectStore.delete(key))
|
|
411
|
+
);
|
|
404
412
|
}
|
|
405
413
|
}
|
|
406
414
|
async reset() {
|
|
@@ -33,7 +33,7 @@ async function mkdirp(providerExtUri, provider, directory) {
|
|
|
33
33
|
const stat = await provider.stat(directory);
|
|
34
34
|
if ((stat.type & FileType.Directory) === 0) {
|
|
35
35
|
throw ( new Error(( localize(
|
|
36
|
-
|
|
36
|
+
2327,
|
|
37
37
|
"Unable to create folder '{0}' that already exists but is not a directory",
|
|
38
38
|
resourceForError(directory)
|
|
39
39
|
))));
|
|
@@ -151,15 +151,15 @@ let FileService = class FileService extends Disposable {
|
|
|
151
151
|
return !!(provider && (provider.capabilities & capability));
|
|
152
152
|
}
|
|
153
153
|
listCapabilities() {
|
|
154
|
-
return
|
|
154
|
+
return Iterable.map(this.provider, ([scheme, provider]) => ({
|
|
155
155
|
scheme,
|
|
156
156
|
capabilities: provider.capabilities
|
|
157
|
-
}))
|
|
157
|
+
}));
|
|
158
158
|
}
|
|
159
159
|
async withProvider(resource) {
|
|
160
160
|
if (!isAbsolutePath(resource)) {
|
|
161
161
|
throw ( new FileOperationError(( localize(
|
|
162
|
-
|
|
162
|
+
2328,
|
|
163
163
|
"Unable to resolve filesystem provider with relative file path '{0}'",
|
|
164
164
|
this.resourceForError(resource)
|
|
165
165
|
)), FileOperationResult.FILE_INVALID_PATH));
|
|
@@ -169,7 +169,7 @@ let FileService = class FileService extends Disposable {
|
|
|
169
169
|
if (!provider) {
|
|
170
170
|
const error = ( new ErrorNoTelemetry());
|
|
171
171
|
error.message = ( localize(
|
|
172
|
-
|
|
172
|
+
2329,
|
|
173
173
|
"ENOPRO: No file system provider found for resource '{0}'",
|
|
174
174
|
(resource.toString())
|
|
175
175
|
));
|
|
@@ -201,7 +201,7 @@ let FileService = class FileService extends Disposable {
|
|
|
201
201
|
} catch (error) {
|
|
202
202
|
if (toFileSystemProviderErrorCode(error) === FileSystemProviderErrorCode.FileNotFound) {
|
|
203
203
|
throw ( new FileOperationError(( localize(
|
|
204
|
-
|
|
204
|
+
2330,
|
|
205
205
|
"Unable to resolve nonexistent file '{0}'",
|
|
206
206
|
this.resourceForError(resource)
|
|
207
207
|
)), FileOperationResult.FILE_NOT_FOUND));
|
|
@@ -269,7 +269,7 @@ let FileService = class FileService extends Disposable {
|
|
|
269
269
|
if (fileStat.isDirectory && recurse(fileStat, siblings)) {
|
|
270
270
|
try {
|
|
271
271
|
const entries = await provider.readdir(resource);
|
|
272
|
-
const resolvedEntries = await Promises.settled(
|
|
272
|
+
const resolvedEntries = await Promises.settled(entries.map(async ([name, type]) => {
|
|
273
273
|
try {
|
|
274
274
|
const childResource = providerExtUri.joinPath(resource, name);
|
|
275
275
|
const childStat = resolveMetadata ? await provider.stat(childResource) : {
|
|
@@ -287,7 +287,7 @@ let FileService = class FileService extends Disposable {
|
|
|
287
287
|
this.logService.trace(error);
|
|
288
288
|
return null;
|
|
289
289
|
}
|
|
290
|
-
}))
|
|
290
|
+
}));
|
|
291
291
|
fileStat.children = coalesce(resolvedEntries);
|
|
292
292
|
} catch (error) {
|
|
293
293
|
this.logService.trace(error);
|
|
@@ -298,7 +298,7 @@ let FileService = class FileService extends Disposable {
|
|
|
298
298
|
return fileStat;
|
|
299
299
|
}
|
|
300
300
|
async resolveAll(toResolve) {
|
|
301
|
-
return Promises.settled(
|
|
301
|
+
return Promises.settled(toResolve.map(async entry => {
|
|
302
302
|
try {
|
|
303
303
|
return {
|
|
304
304
|
stat: await this.doResolveFile(entry.resource, entry.options),
|
|
@@ -313,7 +313,7 @@ let FileService = class FileService extends Disposable {
|
|
|
313
313
|
success: false
|
|
314
314
|
};
|
|
315
315
|
}
|
|
316
|
-
}))
|
|
316
|
+
}));
|
|
317
317
|
}
|
|
318
318
|
async stat(resource) {
|
|
319
319
|
const provider = await this.withProvider(resource);
|
|
@@ -357,7 +357,7 @@ let FileService = class FileService extends Disposable {
|
|
|
357
357
|
async doValidateCreateFile(resource, options) {
|
|
358
358
|
if (!options?.overwrite && (await this.exists(resource))) {
|
|
359
359
|
throw ( new FileOperationError(( localize(
|
|
360
|
-
|
|
360
|
+
2331,
|
|
361
361
|
"Unable to create file '{0}' that already exists when overwrite flag is not set",
|
|
362
362
|
this.resourceForError(resource)
|
|
363
363
|
)), FileOperationResult.FILE_MODIFIED_SINCE, options));
|
|
@@ -415,7 +415,7 @@ let FileService = class FileService extends Disposable {
|
|
|
415
415
|
this._onDidRunOperation.fire(( new FileOperationEvent(resource, FileOperation.WRITE)));
|
|
416
416
|
} catch (error) {
|
|
417
417
|
throw ( new FileOperationError(( localize(
|
|
418
|
-
|
|
418
|
+
2332,
|
|
419
419
|
"Unable to write file '{0}' ({1})",
|
|
420
420
|
this.resourceForError(resource),
|
|
421
421
|
(ensureFileSystemProviderError(error).toString())
|
|
@@ -447,14 +447,14 @@ let FileService = class FileService extends Disposable {
|
|
|
447
447
|
const unlock = !!options?.unlock;
|
|
448
448
|
if (unlock && !(provider.capabilities & FileSystemProviderCapabilities.FileWriteUnlock)) {
|
|
449
449
|
throw ( new Error(( localize(
|
|
450
|
-
|
|
450
|
+
2333,
|
|
451
451
|
"Unable to unlock file '{0}' because provider does not support it.",
|
|
452
452
|
this.resourceForError(resource)
|
|
453
453
|
))));
|
|
454
454
|
}
|
|
455
455
|
if (options?.append && !hasFileAppendCapability(provider)) {
|
|
456
456
|
throw ( new FileOperationError(( localize(
|
|
457
|
-
|
|
457
|
+
2334,
|
|
458
458
|
"Filesystem provider for scheme '{0}' does not does not support append",
|
|
459
459
|
this.resourceForError(resource)
|
|
460
460
|
)), FileOperationResult.FILE_PERMISSION_DENIED));
|
|
@@ -463,21 +463,21 @@ let FileService = class FileService extends Disposable {
|
|
|
463
463
|
if (atomic) {
|
|
464
464
|
if (!(provider.capabilities & FileSystemProviderCapabilities.FileAtomicWrite)) {
|
|
465
465
|
throw ( new Error(( localize(
|
|
466
|
-
|
|
466
|
+
2335,
|
|
467
467
|
"Unable to atomically write file '{0}' because provider does not support it.",
|
|
468
468
|
this.resourceForError(resource)
|
|
469
469
|
))));
|
|
470
470
|
}
|
|
471
471
|
if (!(provider.capabilities & FileSystemProviderCapabilities.FileReadWrite)) {
|
|
472
472
|
throw ( new Error(( localize(
|
|
473
|
-
|
|
473
|
+
2336,
|
|
474
474
|
"Unable to atomically write file '{0}' because provider does not support unbuffered writes.",
|
|
475
475
|
this.resourceForError(resource)
|
|
476
476
|
))));
|
|
477
477
|
}
|
|
478
478
|
if (unlock) {
|
|
479
479
|
throw ( new Error(( localize(
|
|
480
|
-
|
|
480
|
+
2337,
|
|
481
481
|
"Unable to unlock file '{0}' because atomic write is enabled.",
|
|
482
482
|
this.resourceForError(resource)
|
|
483
483
|
))));
|
|
@@ -491,7 +491,7 @@ let FileService = class FileService extends Disposable {
|
|
|
491
491
|
}
|
|
492
492
|
if ((stat.type & FileType.Directory) !== 0) {
|
|
493
493
|
throw ( new FileOperationError(( localize(
|
|
494
|
-
|
|
494
|
+
2338,
|
|
495
495
|
"Unable to write file '{0}' that is actually a directory",
|
|
496
496
|
this.resourceForError(resource)
|
|
497
497
|
)), FileOperationResult.FILE_IS_DIRECTORY, options));
|
|
@@ -520,7 +520,7 @@ let FileService = class FileService extends Disposable {
|
|
|
520
520
|
}
|
|
521
521
|
} catch (error) {}
|
|
522
522
|
}
|
|
523
|
-
throw ( new FileOperationError(( localize(
|
|
523
|
+
throw ( new FileOperationError(( localize(2339, "File Modified Since")), FileOperationResult.FILE_MODIFIED_SINCE, options));
|
|
524
524
|
}
|
|
525
525
|
return {
|
|
526
526
|
stat,
|
|
@@ -604,7 +604,7 @@ let FileService = class FileService extends Disposable {
|
|
|
604
604
|
}
|
|
605
605
|
restoreReadError(error, resource, options) {
|
|
606
606
|
const message = ( localize(
|
|
607
|
-
|
|
607
|
+
2340,
|
|
608
608
|
"Unable to read file '{0}' ({1})",
|
|
609
609
|
this.resourceForError(resource),
|
|
610
610
|
(ensureFileSystemProviderError(error).toString())
|
|
@@ -666,13 +666,13 @@ let FileService = class FileService extends Disposable {
|
|
|
666
666
|
});
|
|
667
667
|
if (stat.isDirectory) {
|
|
668
668
|
throw ( new FileOperationError(( localize(
|
|
669
|
-
|
|
669
|
+
2341,
|
|
670
670
|
"Unable to read file '{0}' that is actually a directory",
|
|
671
671
|
this.resourceForError(resource)
|
|
672
672
|
)), FileOperationResult.FILE_IS_DIRECTORY, options));
|
|
673
673
|
}
|
|
674
674
|
if (typeof options?.etag === "string" && options.etag !== ETAG_DISABLED && options.etag === stat.etag) {
|
|
675
|
-
throw ( new NotModifiedSinceFileOperationError(( localize(
|
|
675
|
+
throw ( new NotModifiedSinceFileOperationError(( localize(2342, "File not modified since")), stat, options));
|
|
676
676
|
}
|
|
677
677
|
this.validateReadFileLimits(resource, stat.size, options);
|
|
678
678
|
return stat;
|
|
@@ -680,7 +680,7 @@ let FileService = class FileService extends Disposable {
|
|
|
680
680
|
validateReadFileLimits(resource, size, options) {
|
|
681
681
|
if (typeof options?.limits?.size === "number" && size > options.limits.size) {
|
|
682
682
|
throw ( new TooLargeFileOperationError(( localize(
|
|
683
|
-
|
|
683
|
+
2343,
|
|
684
684
|
"Unable to read file '{0}' that is too large to open",
|
|
685
685
|
this.resourceForError(resource)
|
|
686
686
|
)), FileOperationResult.FILE_TOO_LARGE, size, options));
|
|
@@ -798,7 +798,7 @@ let FileService = class FileService extends Disposable {
|
|
|
798
798
|
async doCopyFolder(sourceProvider, sourceFolder, targetProvider, targetFolder) {
|
|
799
799
|
await targetProvider.mkdir(targetFolder);
|
|
800
800
|
if (Array.isArray(sourceFolder.children)) {
|
|
801
|
-
await Promises.settled(
|
|
801
|
+
await Promises.settled(sourceFolder.children.map(async sourceChild => {
|
|
802
802
|
const targetChild = this.getExtUri(targetProvider).providerExtUri.joinPath(targetFolder, sourceChild.name);
|
|
803
803
|
if (sourceChild.isDirectory) {
|
|
804
804
|
return this.doCopyFolder(
|
|
@@ -810,7 +810,7 @@ let FileService = class FileService extends Disposable {
|
|
|
810
810
|
} else {
|
|
811
811
|
return this.doCopyFile(sourceProvider, sourceChild.resource, targetProvider, targetChild);
|
|
812
812
|
}
|
|
813
|
-
}))
|
|
813
|
+
}));
|
|
814
814
|
}
|
|
815
815
|
}
|
|
816
816
|
async doValidateMoveCopy(sourceProvider, source, targetProvider, target, mode, overwrite) {
|
|
@@ -825,7 +825,7 @@ let FileService = class FileService extends Disposable {
|
|
|
825
825
|
}
|
|
826
826
|
if (isSameResourceWithDifferentPathCase && mode === "copy") {
|
|
827
827
|
throw ( new Error(( localize(
|
|
828
|
-
|
|
828
|
+
2344,
|
|
829
829
|
"Unable to copy when source '{0}' is same as target '{1}' with different path case on a case insensitive file system",
|
|
830
830
|
this.resourceForError(source),
|
|
831
831
|
this.resourceForError(target)
|
|
@@ -833,7 +833,7 @@ let FileService = class FileService extends Disposable {
|
|
|
833
833
|
}
|
|
834
834
|
if (!isSameResourceWithDifferentPathCase && providerExtUri.isEqualOrParent(target, source)) {
|
|
835
835
|
throw ( new Error(( localize(
|
|
836
|
-
|
|
836
|
+
2345,
|
|
837
837
|
"Unable to move/copy when source '{0}' is parent of target '{1}'.",
|
|
838
838
|
this.resourceForError(source),
|
|
839
839
|
this.resourceForError(target)
|
|
@@ -844,7 +844,7 @@ let FileService = class FileService extends Disposable {
|
|
|
844
844
|
if (exists && !isSameResourceWithDifferentPathCase) {
|
|
845
845
|
if (!overwrite) {
|
|
846
846
|
throw ( new FileOperationError(( localize(
|
|
847
|
-
|
|
847
|
+
2346,
|
|
848
848
|
"Unable to move/copy '{0}' because target '{1}' already exists at destination.",
|
|
849
849
|
this.resourceForError(source),
|
|
850
850
|
this.resourceForError(target)
|
|
@@ -856,7 +856,7 @@ let FileService = class FileService extends Disposable {
|
|
|
856
856
|
} = this.getExtUri(sourceProvider);
|
|
857
857
|
if (providerExtUri.isEqualOrParent(source, target)) {
|
|
858
858
|
throw ( new Error(( localize(
|
|
859
|
-
|
|
859
|
+
2347,
|
|
860
860
|
"Unable to move/copy '{0}' into '{1}' since a file would replace the folder it is contained in.",
|
|
861
861
|
this.resourceForError(source),
|
|
862
862
|
this.resourceForError(target)
|
|
@@ -907,7 +907,7 @@ let FileService = class FileService extends Disposable {
|
|
|
907
907
|
const useTrash = !!options?.useTrash;
|
|
908
908
|
if (useTrash && !(provider.capabilities & FileSystemProviderCapabilities.Trash)) {
|
|
909
909
|
throw ( new Error(( localize(
|
|
910
|
-
|
|
910
|
+
2348,
|
|
911
911
|
"Unable to delete file '{0}' via trash because provider does not support it.",
|
|
912
912
|
this.resourceForError(resource)
|
|
913
913
|
))));
|
|
@@ -915,14 +915,14 @@ let FileService = class FileService extends Disposable {
|
|
|
915
915
|
const atomic = options?.atomic;
|
|
916
916
|
if (atomic && !(provider.capabilities & FileSystemProviderCapabilities.FileAtomicDelete)) {
|
|
917
917
|
throw ( new Error(( localize(
|
|
918
|
-
|
|
918
|
+
2349,
|
|
919
919
|
"Unable to delete file '{0}' atomically because provider does not support it.",
|
|
920
920
|
this.resourceForError(resource)
|
|
921
921
|
))));
|
|
922
922
|
}
|
|
923
923
|
if (useTrash && atomic) {
|
|
924
924
|
throw ( new Error(( localize(
|
|
925
|
-
|
|
925
|
+
2350,
|
|
926
926
|
"Unable to atomically delete file '{0}' because using trash is enabled.",
|
|
927
927
|
this.resourceForError(resource)
|
|
928
928
|
))));
|
|
@@ -935,7 +935,7 @@ let FileService = class FileService extends Disposable {
|
|
|
935
935
|
this.throwIfFileIsReadonly(resource, stat);
|
|
936
936
|
} else {
|
|
937
937
|
throw ( new FileOperationError(( localize(
|
|
938
|
-
|
|
938
|
+
2351,
|
|
939
939
|
"Unable to delete nonexistent file '{0}'",
|
|
940
940
|
this.resourceForError(resource)
|
|
941
941
|
)), FileOperationResult.FILE_NOT_FOUND));
|
|
@@ -945,7 +945,7 @@ let FileService = class FileService extends Disposable {
|
|
|
945
945
|
const stat = await this.resolve(resource);
|
|
946
946
|
if (stat.isDirectory && Array.isArray(stat.children) && stat.children.length > 0) {
|
|
947
947
|
throw ( new Error(( localize(
|
|
948
|
-
|
|
948
|
+
2352,
|
|
949
949
|
"Unable to delete non-empty folder '{0}'.",
|
|
950
950
|
this.resourceForError(resource)
|
|
951
951
|
))));
|
|
@@ -1278,7 +1278,7 @@ let FileService = class FileService extends Disposable {
|
|
|
1278
1278
|
throwIfFileSystemIsReadonly(provider, resource) {
|
|
1279
1279
|
if (provider.capabilities & FileSystemProviderCapabilities.Readonly) {
|
|
1280
1280
|
throw ( new FileOperationError(( localize(
|
|
1281
|
-
|
|
1281
|
+
2353,
|
|
1282
1282
|
"Unable to modify read-only file '{0}'",
|
|
1283
1283
|
this.resourceForError(resource)
|
|
1284
1284
|
)), FileOperationResult.FILE_PERMISSION_DENIED));
|
|
@@ -1288,7 +1288,7 @@ let FileService = class FileService extends Disposable {
|
|
|
1288
1288
|
throwIfFileIsReadonly(resource, stat) {
|
|
1289
1289
|
if ((stat.permissions ?? 0) & FilePermission.Readonly) {
|
|
1290
1290
|
throw ( new FileOperationError(( localize(
|
|
1291
|
-
|
|
1291
|
+
2353,
|
|
1292
1292
|
"Unable to modify read-only file '{0}'",
|
|
1293
1293
|
this.resourceForError(resource)
|
|
1294
1294
|
)), FileOperationResult.FILE_PERMISSION_DENIED));
|
|
@@ -80,7 +80,7 @@ function throwIfCancelled(token) {
|
|
|
80
80
|
}
|
|
81
81
|
function throwIfTooLarge(totalBytesRead, options) {
|
|
82
82
|
if (typeof options?.limits?.size === "number" && totalBytesRead > options.limits.size) {
|
|
83
|
-
throw createFileSystemProviderError(( localize(
|
|
83
|
+
throw createFileSystemProviderError(( localize(2360, "File is too large to open")), FileSystemProviderErrorCode.FileTooLarge);
|
|
84
84
|
}
|
|
85
85
|
return true;
|
|
86
86
|
}
|
|
@@ -56,10 +56,10 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
56
56
|
AbstractTextFileService_1 = this;
|
|
57
57
|
}
|
|
58
58
|
static {
|
|
59
|
-
this.TEXTFILE_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource("textFileCreate.source", ( localize(
|
|
59
|
+
this.TEXTFILE_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource("textFileCreate.source", ( localize(22194, "File Created")));
|
|
60
60
|
}
|
|
61
61
|
static {
|
|
62
|
-
this.TEXTFILE_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource("textFileOverwrite.source", ( localize(
|
|
62
|
+
this.TEXTFILE_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource("textFileOverwrite.source", ( localize(22195, "File Replaced")));
|
|
63
63
|
}
|
|
64
64
|
constructor(
|
|
65
65
|
fileService,
|
|
@@ -108,7 +108,7 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
108
108
|
constructor(files) {
|
|
109
109
|
super();
|
|
110
110
|
this.files = files;
|
|
111
|
-
this.label = ( localize(
|
|
111
|
+
this.label = ( localize(22196, "Text File Model Decorations"));
|
|
112
112
|
this._onDidChange = this._register(( new Emitter()));
|
|
113
113
|
this.onDidChange = this._onDidChange.event;
|
|
114
114
|
this.registerListeners();
|
|
@@ -143,20 +143,20 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
143
143
|
color: listErrorForeground,
|
|
144
144
|
letter: Codicon.lockSmall,
|
|
145
145
|
strikethrough: true,
|
|
146
|
-
tooltip: ( localize(
|
|
146
|
+
tooltip: ( localize(22197, "Deleted, Read-only"))
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
149
|
else if (isReadonly) {
|
|
150
150
|
return {
|
|
151
151
|
letter: Codicon.lockSmall,
|
|
152
|
-
tooltip: ( localize(
|
|
152
|
+
tooltip: ( localize(22198, "Read-only"))
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
155
|
else if (isOrphaned) {
|
|
156
156
|
return {
|
|
157
157
|
color: listErrorForeground,
|
|
158
158
|
strikethrough: true,
|
|
159
|
-
tooltip: ( localize(
|
|
159
|
+
tooltip: ( localize(22199, "Deleted"))
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
162
|
return undefined;
|
|
@@ -207,7 +207,7 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
207
207
|
} catch (error) {
|
|
208
208
|
cts.dispose(true);
|
|
209
209
|
if (error.decodeStreamErrorKind === DecodeStreamErrorKind.STREAM_IS_BINARY) {
|
|
210
|
-
throw ( new TextFileOperationError(( localize(
|
|
210
|
+
throw ( new TextFileOperationError(( localize(22200, "File seems to be binary and cannot be opened as text")), TextFileOperationResult.FILE_IS_BINARY, options));
|
|
211
211
|
}
|
|
212
212
|
else {
|
|
213
213
|
throw error;
|
|
@@ -215,14 +215,14 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
async create(operations, undoInfo) {
|
|
218
|
-
const operationsWithContents = await Promise.all(
|
|
218
|
+
const operationsWithContents = await Promise.all(operations.map(async operation => {
|
|
219
219
|
const contents = await this.getEncodedReadable(operation.resource, operation.value);
|
|
220
220
|
return {
|
|
221
221
|
resource: operation.resource,
|
|
222
222
|
contents,
|
|
223
223
|
overwrite: operation.options?.overwrite
|
|
224
224
|
};
|
|
225
|
-
}))
|
|
225
|
+
}));
|
|
226
226
|
return this.workingCopyFileService.create(operationsWithContents, CancellationToken.None, undoInfo);
|
|
227
227
|
}
|
|
228
228
|
async write(resource, value, options) {
|
|
@@ -481,17 +481,17 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
481
481
|
} = await this.dialogService.confirm({
|
|
482
482
|
type: "warning",
|
|
483
483
|
message: ( localize(
|
|
484
|
-
|
|
484
|
+
22201,
|
|
485
485
|
"'{0}' already exists. Do you want to replace it?",
|
|
486
486
|
basename(resource)
|
|
487
487
|
)),
|
|
488
488
|
detail: ( localize(
|
|
489
|
-
|
|
489
|
+
22202,
|
|
490
490
|
"A file or folder with the name '{0}' already exists in the folder '{1}'. Replacing it will overwrite its current contents.",
|
|
491
491
|
basename(resource),
|
|
492
492
|
basename(dirname(resource))
|
|
493
493
|
)),
|
|
494
|
-
primaryButton: ( localize(
|
|
494
|
+
primaryButton: ( localize(22203, "&&Replace"))
|
|
495
495
|
});
|
|
496
496
|
return confirmed;
|
|
497
497
|
}
|
|
@@ -501,12 +501,12 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
501
501
|
} = await this.dialogService.confirm({
|
|
502
502
|
type: "warning",
|
|
503
503
|
message: ( localize(
|
|
504
|
-
|
|
504
|
+
22204,
|
|
505
505
|
"'{0}' is marked as read-only. Do you want to save anyway?",
|
|
506
506
|
basename(resource)
|
|
507
507
|
)),
|
|
508
|
-
detail: ( localize(
|
|
509
|
-
primaryButton: ( localize(
|
|
508
|
+
detail: ( localize(22205, "Paths can be configured as read-only via settings.")),
|
|
509
|
+
primaryButton: ( localize(22206, "&&Save Anyway"))
|
|
510
510
|
});
|
|
511
511
|
return confirmed;
|
|
512
512
|
}
|
|
@@ -70,7 +70,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
70
70
|
return {
|
|
71
71
|
onSaveError(error, model) {
|
|
72
72
|
notificationService.error(( localize(
|
|
73
|
-
|
|
73
|
+
22210,
|
|
74
74
|
"Failed to save '{0}': {1}",
|
|
75
75
|
model.name,
|
|
76
76
|
toErrorMessage(error, false)
|
|
@@ -217,7 +217,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
217
217
|
const modelsToRestore = this.mapCorrelationIdToModelsToRestore.get(e.correlationId);
|
|
218
218
|
if (modelsToRestore) {
|
|
219
219
|
this.mapCorrelationIdToModelsToRestore.delete(e.correlationId);
|
|
220
|
-
await Promises.settled(
|
|
220
|
+
await Promises.settled(modelsToRestore.map(async modelToRestore => {
|
|
221
221
|
const target = this.uriIdentityService.asCanonicalUri(modelToRestore.target);
|
|
222
222
|
const restoredModel = await this.resolve(target, {
|
|
223
223
|
reload: {
|
|
@@ -234,7 +234,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
234
234
|
restoredModel.updateTextEditorModel(undefined, modelToRestore.language.id);
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
-
}))
|
|
237
|
+
}));
|
|
238
238
|
}
|
|
239
239
|
})());
|
|
240
240
|
break;
|
|
@@ -26,13 +26,13 @@ let TextFileSaveParticipant = class TextFileSaveParticipant extends Disposable {
|
|
|
26
26
|
const cts = ( new CancellationTokenSource(token));
|
|
27
27
|
model.textEditorModel?.pushStackElement();
|
|
28
28
|
progress.report({
|
|
29
|
-
message: ( localize(
|
|
29
|
+
message: ( localize(22211, "Running Code Actions and Formatters..."))
|
|
30
30
|
});
|
|
31
31
|
let bubbleCancel = false;
|
|
32
32
|
await this.progressService.withProgress({
|
|
33
33
|
priority: NotificationPriority.URGENT,
|
|
34
34
|
location: ProgressLocation.Notification,
|
|
35
|
-
cancellable: ( localize(
|
|
35
|
+
cancellable: ( localize(22212, "Skip")),
|
|
36
36
|
delay: model.isDirty() ? 5000 : 3000
|
|
37
37
|
}, async progress => {
|
|
38
38
|
const participants = Array.from(this.saveParticipants).sort((a, b) => {
|