@codingame/monaco-vscode-files-service-override 7.1.0 → 7.1.1
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 +8 -10
- package/vscode/src/vs/platform/files/common/fileService.js +53 -79
- package/vscode/src/vs/platform/files/common/io.js +2 -3
- package/vscode/src/vs/workbench/services/textfile/browser/textFileService.js +17 -21
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModelManager.js +3 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-files-service-override",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.1",
|
|
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@7.1.
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@7.1.1"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -5,20 +5,18 @@ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
|
5
5
|
import { ExtUri } from 'vscode/vscode/vs/base/common/resources';
|
|
6
6
|
import { isString } from 'vscode/vscode/vs/base/common/types';
|
|
7
7
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
8
|
-
import {
|
|
8
|
+
import { localize } from 'vscode/vscode/vs/nls';
|
|
9
9
|
import { createFileSystemProviderError, FileSystemProviderErrorCode, FileType, FileSystemProviderCapabilities, FileChangeType, FileSystemProviderError } from 'vscode/vscode/vs/platform/files/common/files';
|
|
10
10
|
import { DBClosedError } from 'vscode/vscode/vs/base/browser/indexedDB';
|
|
11
11
|
import { BroadcastDataChannel } from 'vscode/vscode/vs/base/browser/broadcast';
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
_moduleId,
|
|
21
|
-
5,
|
|
13
|
+
const ERR_FILE_NOT_FOUND = createFileSystemProviderError(( localize(639, "File does not exist")), FileSystemProviderErrorCode.FileNotFound);
|
|
14
|
+
const ERR_FILE_IS_DIR = createFileSystemProviderError(( localize(640, "File is Directory")), FileSystemProviderErrorCode.FileIsADirectory);
|
|
15
|
+
const ERR_FILE_NOT_DIR = createFileSystemProviderError(( localize(641, "File is not a directory")), FileSystemProviderErrorCode.FileNotADirectory);
|
|
16
|
+
const ERR_DIR_NOT_EMPTY = createFileSystemProviderError(( localize(642, "Directory is not empty")), FileSystemProviderErrorCode.Unknown);
|
|
17
|
+
const ERR_FILE_EXCEEDS_STORAGE_QUOTA = createFileSystemProviderError(( localize(643, "File exceeds available storage quota")), FileSystemProviderErrorCode.FileExceedsStorageQuota);
|
|
18
|
+
const ERR_UNKNOWN_INTERNAL = (message) => createFileSystemProviderError(( localize(
|
|
19
|
+
644,
|
|
22
20
|
"Internal error occurred in IndexedDB File System Provider. ({0})",
|
|
23
21
|
message
|
|
24
22
|
)), FileSystemProviderErrorCode.Unknown);
|
|
@@ -12,14 +12,13 @@ import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
|
12
12
|
import { mark } from 'vscode/vscode/vs/base/common/performance';
|
|
13
13
|
import { isAbsolutePath, extUri, extUriIgnorePathCase } from 'vscode/vscode/vs/base/common/resources';
|
|
14
14
|
import { isReadableStream, peekStream, peekReadable, consumeStream, transform, newWriteableStream, isReadableBufferedStream, listenStream } from 'vscode/vscode/vs/base/common/stream';
|
|
15
|
-
import {
|
|
15
|
+
import { localize } from 'vscode/vscode/vs/nls';
|
|
16
16
|
import { FileType, toFileSystemProviderErrorCode, FileSystemProviderErrorCode, FileChangesEvent, FileOperationError, FileOperationResult, hasOpenReadWriteCloseCapability, hasReadWriteCapability, hasFileReadStreamCapability, ensureFileSystemProviderError, FilePermission, FileSystemProviderCapabilities, etag, FileOperationEvent, FileOperation, hasFileAtomicWriteCapability, toFileOperationResult, ETAG_DISABLED, hasFileAtomicReadCapability, NotModifiedSinceFileOperationError, TooLargeFileOperationError, hasFileFolderCopyCapability, hasFileAtomicDeleteCapability, hasFileCloneCapability } from 'vscode/vscode/vs/platform/files/common/files';
|
|
17
17
|
import { readFileIntoStream } from './io.js';
|
|
18
18
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
19
19
|
import { ErrorNoTelemetry } from 'vscode/vscode/vs/base/common/errors';
|
|
20
20
|
|
|
21
21
|
var FileService_1;
|
|
22
|
-
const _moduleId = "vs/platform/files/common/fileService";
|
|
23
22
|
function resourceForError(resource) {
|
|
24
23
|
if (resource.scheme === Schemas.file) {
|
|
25
24
|
return resource.fsPath;
|
|
@@ -34,9 +33,8 @@ async function mkdirp(providerExtUri, provider, directory) {
|
|
|
34
33
|
try {
|
|
35
34
|
const stat = await provider.stat(directory);
|
|
36
35
|
if ((stat.type & FileType.Directory) === 0) {
|
|
37
|
-
throw ( (new Error(
|
|
38
|
-
|
|
39
|
-
0,
|
|
36
|
+
throw ( (new Error(localize(
|
|
37
|
+
611,
|
|
40
38
|
"Unable to create folder '{0}' that already exists but is not a directory",
|
|
41
39
|
resourceForError(directory)
|
|
42
40
|
))));
|
|
@@ -150,9 +148,8 @@ let FileService = class FileService extends Disposable {
|
|
|
150
148
|
}
|
|
151
149
|
async withProvider(resource) {
|
|
152
150
|
if (!isAbsolutePath(resource)) {
|
|
153
|
-
throw ( (new FileOperationError(
|
|
154
|
-
|
|
155
|
-
1,
|
|
151
|
+
throw ( (new FileOperationError(localize(
|
|
152
|
+
612,
|
|
156
153
|
"Unable to resolve filesystem provider with relative file path '{0}'",
|
|
157
154
|
this.resourceForError(resource)
|
|
158
155
|
), FileOperationResult.FILE_INVALID_PATH)));
|
|
@@ -161,9 +158,8 @@ let FileService = class FileService extends Disposable {
|
|
|
161
158
|
const provider = this.provider.get(resource.scheme);
|
|
162
159
|
if (!provider) {
|
|
163
160
|
const error = ( (new ErrorNoTelemetry()));
|
|
164
|
-
error.message = (
|
|
165
|
-
|
|
166
|
-
2,
|
|
161
|
+
error.message = ( localize(
|
|
162
|
+
613,
|
|
167
163
|
"ENOPRO: No file system provider found for resource '{0}'",
|
|
168
164
|
(resource.toString())
|
|
169
165
|
));
|
|
@@ -195,9 +191,8 @@ let FileService = class FileService extends Disposable {
|
|
|
195
191
|
}
|
|
196
192
|
catch (error) {
|
|
197
193
|
if (toFileSystemProviderErrorCode(error) === FileSystemProviderErrorCode.FileNotFound) {
|
|
198
|
-
throw ( (new FileOperationError(
|
|
199
|
-
|
|
200
|
-
3,
|
|
194
|
+
throw ( (new FileOperationError(localize(
|
|
195
|
+
614,
|
|
201
196
|
"Unable to resolve nonexistent file '{0}'",
|
|
202
197
|
this.resourceForError(resource)
|
|
203
198
|
), FileOperationResult.FILE_NOT_FOUND)));
|
|
@@ -307,9 +302,8 @@ let FileService = class FileService extends Disposable {
|
|
|
307
302
|
}
|
|
308
303
|
async doValidateCreateFile(resource, options) {
|
|
309
304
|
if (!options?.overwrite && (await this.exists(resource))) {
|
|
310
|
-
throw ( (new FileOperationError(
|
|
311
|
-
|
|
312
|
-
4,
|
|
305
|
+
throw ( (new FileOperationError(localize(
|
|
306
|
+
615,
|
|
313
307
|
"Unable to create file '{0}' that already exists when overwrite flag is not set",
|
|
314
308
|
this.resourceForError(resource)
|
|
315
309
|
), FileOperationResult.FILE_MODIFIED_SINCE, options)));
|
|
@@ -366,9 +360,8 @@ let FileService = class FileService extends Disposable {
|
|
|
366
360
|
this._onDidRunOperation.fire(( (new FileOperationEvent(resource, FileOperation.WRITE))));
|
|
367
361
|
}
|
|
368
362
|
catch (error) {
|
|
369
|
-
throw ( (new FileOperationError(
|
|
370
|
-
|
|
371
|
-
5,
|
|
363
|
+
throw ( (new FileOperationError(localize(
|
|
364
|
+
616,
|
|
372
365
|
"Unable to write file '{0}' ({1})",
|
|
373
366
|
this.resourceForError(resource),
|
|
374
367
|
( (ensureFileSystemProviderError(error).toString()))
|
|
@@ -379,9 +372,8 @@ let FileService = class FileService extends Disposable {
|
|
|
379
372
|
async validateWriteFile(provider, resource, options) {
|
|
380
373
|
const unlock = !!options?.unlock;
|
|
381
374
|
if (unlock && !(provider.capabilities & FileSystemProviderCapabilities.FileWriteUnlock)) {
|
|
382
|
-
throw ( (new Error(
|
|
383
|
-
|
|
384
|
-
6,
|
|
375
|
+
throw ( (new Error(localize(
|
|
376
|
+
617,
|
|
385
377
|
"Unable to unlock file '{0}' because provider does not support it.",
|
|
386
378
|
this.resourceForError(resource)
|
|
387
379
|
))));
|
|
@@ -389,25 +381,22 @@ let FileService = class FileService extends Disposable {
|
|
|
389
381
|
const atomic = !!options?.atomic;
|
|
390
382
|
if (atomic) {
|
|
391
383
|
if (!(provider.capabilities & FileSystemProviderCapabilities.FileAtomicWrite)) {
|
|
392
|
-
throw ( (new Error(
|
|
393
|
-
|
|
394
|
-
7,
|
|
384
|
+
throw ( (new Error(localize(
|
|
385
|
+
618,
|
|
395
386
|
"Unable to atomically write file '{0}' because provider does not support it.",
|
|
396
387
|
this.resourceForError(resource)
|
|
397
388
|
))));
|
|
398
389
|
}
|
|
399
390
|
if (!(provider.capabilities & FileSystemProviderCapabilities.FileReadWrite)) {
|
|
400
|
-
throw ( (new Error(
|
|
401
|
-
|
|
402
|
-
8,
|
|
391
|
+
throw ( (new Error(localize(
|
|
392
|
+
619,
|
|
403
393
|
"Unable to atomically write file '{0}' because provider does not support unbuffered writes.",
|
|
404
394
|
this.resourceForError(resource)
|
|
405
395
|
))));
|
|
406
396
|
}
|
|
407
397
|
if (unlock) {
|
|
408
|
-
throw ( (new Error(
|
|
409
|
-
|
|
410
|
-
9,
|
|
398
|
+
throw ( (new Error(localize(
|
|
399
|
+
620,
|
|
411
400
|
"Unable to unlock file '{0}' because atomic write is enabled.",
|
|
412
401
|
this.resourceForError(resource)
|
|
413
402
|
))));
|
|
@@ -421,9 +410,8 @@ let FileService = class FileService extends Disposable {
|
|
|
421
410
|
return undefined;
|
|
422
411
|
}
|
|
423
412
|
if ((stat.type & FileType.Directory) !== 0) {
|
|
424
|
-
throw ( (new FileOperationError(
|
|
425
|
-
|
|
426
|
-
10,
|
|
413
|
+
throw ( (new FileOperationError(localize(
|
|
414
|
+
621,
|
|
427
415
|
"Unable to write file '{0}' that is actually a directory",
|
|
428
416
|
this.resourceForError(resource)
|
|
429
417
|
), FileOperationResult.FILE_IS_DIRECTORY, options)));
|
|
@@ -433,7 +421,7 @@ let FileService = class FileService extends Disposable {
|
|
|
433
421
|
typeof stat.mtime === 'number' && typeof stat.size === 'number' &&
|
|
434
422
|
options.mtime < stat.mtime && options.etag !== etag({ mtime: options.mtime , size: stat.size })) {
|
|
435
423
|
throw ( (new FileOperationError(
|
|
436
|
-
|
|
424
|
+
localize(622, "File Modified Since"),
|
|
437
425
|
FileOperationResult.FILE_MODIFIED_SINCE,
|
|
438
426
|
options
|
|
439
427
|
)));
|
|
@@ -519,9 +507,8 @@ let FileService = class FileService extends Disposable {
|
|
|
519
507
|
}
|
|
520
508
|
}
|
|
521
509
|
restoreReadError(error, resource, options) {
|
|
522
|
-
const message = (
|
|
523
|
-
|
|
524
|
-
12,
|
|
510
|
+
const message = ( localize(
|
|
511
|
+
623,
|
|
525
512
|
"Unable to read file '{0}' ({1})",
|
|
526
513
|
this.resourceForError(resource),
|
|
527
514
|
(ensureFileSystemProviderError(error).toString())
|
|
@@ -586,24 +573,22 @@ let FileService = class FileService extends Disposable {
|
|
|
586
573
|
async validateReadFile(resource, options) {
|
|
587
574
|
const stat = await this.resolve(resource, { resolveMetadata: true });
|
|
588
575
|
if (stat.isDirectory) {
|
|
589
|
-
throw ( (new FileOperationError(
|
|
590
|
-
|
|
591
|
-
13,
|
|
576
|
+
throw ( (new FileOperationError(localize(
|
|
577
|
+
624,
|
|
592
578
|
"Unable to read file '{0}' that is actually a directory",
|
|
593
579
|
this.resourceForError(resource)
|
|
594
580
|
), FileOperationResult.FILE_IS_DIRECTORY, options)));
|
|
595
581
|
}
|
|
596
582
|
if (typeof options?.etag === 'string' && options.etag !== ETAG_DISABLED && options.etag === stat.etag) {
|
|
597
|
-
throw ( (new NotModifiedSinceFileOperationError(
|
|
583
|
+
throw ( (new NotModifiedSinceFileOperationError(localize(625, "File not modified since"), stat, options)));
|
|
598
584
|
}
|
|
599
585
|
this.validateReadFileLimits(resource, stat.size, options);
|
|
600
586
|
return stat;
|
|
601
587
|
}
|
|
602
588
|
validateReadFileLimits(resource, size, options) {
|
|
603
589
|
if (typeof options?.limits?.size === 'number' && size > options.limits.size) {
|
|
604
|
-
throw ( (new TooLargeFileOperationError(
|
|
605
|
-
|
|
606
|
-
15,
|
|
590
|
+
throw ( (new TooLargeFileOperationError(localize(
|
|
591
|
+
626,
|
|
607
592
|
"Unable to read file '{0}' that is too large to open",
|
|
608
593
|
this.resourceForError(resource)
|
|
609
594
|
), FileOperationResult.FILE_TOO_LARGE, size, options)));
|
|
@@ -724,18 +709,16 @@ let FileService = class FileService extends Disposable {
|
|
|
724
709
|
isSameResourceWithDifferentPathCase = providerExtUri.isEqual(source, target);
|
|
725
710
|
}
|
|
726
711
|
if (isSameResourceWithDifferentPathCase && mode === 'copy') {
|
|
727
|
-
throw ( (new Error(
|
|
728
|
-
|
|
729
|
-
16,
|
|
712
|
+
throw ( (new Error(localize(
|
|
713
|
+
627,
|
|
730
714
|
"Unable to copy when source '{0}' is same as target '{1}' with different path case on a case insensitive file system",
|
|
731
715
|
this.resourceForError(source),
|
|
732
716
|
this.resourceForError(target)
|
|
733
717
|
))));
|
|
734
718
|
}
|
|
735
719
|
if (!isSameResourceWithDifferentPathCase && providerExtUri.isEqualOrParent(target, source)) {
|
|
736
|
-
throw ( (new Error(
|
|
737
|
-
|
|
738
|
-
17,
|
|
720
|
+
throw ( (new Error(localize(
|
|
721
|
+
628,
|
|
739
722
|
"Unable to move/copy when source '{0}' is parent of target '{1}'.",
|
|
740
723
|
this.resourceForError(source),
|
|
741
724
|
this.resourceForError(target)
|
|
@@ -745,9 +728,8 @@ let FileService = class FileService extends Disposable {
|
|
|
745
728
|
const exists = await this.exists(target);
|
|
746
729
|
if (exists && !isSameResourceWithDifferentPathCase) {
|
|
747
730
|
if (!overwrite) {
|
|
748
|
-
throw ( (new FileOperationError(
|
|
749
|
-
|
|
750
|
-
18,
|
|
731
|
+
throw ( (new FileOperationError(localize(
|
|
732
|
+
629,
|
|
751
733
|
"Unable to move/copy '{0}' because target '{1}' already exists at destination.",
|
|
752
734
|
this.resourceForError(source),
|
|
753
735
|
this.resourceForError(target)
|
|
@@ -756,9 +738,8 @@ let FileService = class FileService extends Disposable {
|
|
|
756
738
|
if (sourceProvider === targetProvider) {
|
|
757
739
|
const { providerExtUri } = this.getExtUri(sourceProvider);
|
|
758
740
|
if (providerExtUri.isEqualOrParent(source, target)) {
|
|
759
|
-
throw ( (new Error(
|
|
760
|
-
|
|
761
|
-
19,
|
|
741
|
+
throw ( (new Error(localize(
|
|
742
|
+
630,
|
|
762
743
|
"Unable to move/copy '{0}' into '{1}' since a file would replace the folder it is contained in.",
|
|
763
744
|
this.resourceForError(source),
|
|
764
745
|
this.resourceForError(target)
|
|
@@ -802,26 +783,23 @@ let FileService = class FileService extends Disposable {
|
|
|
802
783
|
const provider = this.throwIfFileSystemIsReadonly(await this.withProvider(resource), resource);
|
|
803
784
|
const useTrash = !!options?.useTrash;
|
|
804
785
|
if (useTrash && !(provider.capabilities & FileSystemProviderCapabilities.Trash)) {
|
|
805
|
-
throw ( (new Error(
|
|
806
|
-
|
|
807
|
-
20,
|
|
786
|
+
throw ( (new Error(localize(
|
|
787
|
+
631,
|
|
808
788
|
"Unable to delete file '{0}' via trash because provider does not support it.",
|
|
809
789
|
this.resourceForError(resource)
|
|
810
790
|
))));
|
|
811
791
|
}
|
|
812
792
|
const atomic = options?.atomic;
|
|
813
793
|
if (atomic && !(provider.capabilities & FileSystemProviderCapabilities.FileAtomicDelete)) {
|
|
814
|
-
throw ( (new Error(
|
|
815
|
-
|
|
816
|
-
21,
|
|
794
|
+
throw ( (new Error(localize(
|
|
795
|
+
632,
|
|
817
796
|
"Unable to delete file '{0}' atomically because provider does not support it.",
|
|
818
797
|
this.resourceForError(resource)
|
|
819
798
|
))));
|
|
820
799
|
}
|
|
821
800
|
if (useTrash && atomic) {
|
|
822
|
-
throw ( (new Error(
|
|
823
|
-
|
|
824
|
-
22,
|
|
801
|
+
throw ( (new Error(localize(
|
|
802
|
+
633,
|
|
825
803
|
"Unable to atomically delete file '{0}' because using trash is enabled.",
|
|
826
804
|
this.resourceForError(resource)
|
|
827
805
|
))));
|
|
@@ -836,9 +814,8 @@ let FileService = class FileService extends Disposable {
|
|
|
836
814
|
this.throwIfFileIsReadonly(resource, stat);
|
|
837
815
|
}
|
|
838
816
|
else {
|
|
839
|
-
throw ( (new FileOperationError(
|
|
840
|
-
|
|
841
|
-
23,
|
|
817
|
+
throw ( (new FileOperationError(localize(
|
|
818
|
+
634,
|
|
842
819
|
"Unable to delete nonexistent file '{0}'",
|
|
843
820
|
this.resourceForError(resource)
|
|
844
821
|
), FileOperationResult.FILE_NOT_FOUND)));
|
|
@@ -847,9 +824,8 @@ let FileService = class FileService extends Disposable {
|
|
|
847
824
|
if (!recursive) {
|
|
848
825
|
const stat = await this.resolve(resource);
|
|
849
826
|
if (stat.isDirectory && Array.isArray(stat.children) && stat.children.length > 0) {
|
|
850
|
-
throw ( (new Error(
|
|
851
|
-
|
|
852
|
-
24,
|
|
827
|
+
throw ( (new Error(localize(
|
|
828
|
+
635,
|
|
853
829
|
"Unable to delete non-empty folder '{0}'.",
|
|
854
830
|
this.resourceForError(resource)
|
|
855
831
|
))));
|
|
@@ -1109,9 +1085,8 @@ let FileService = class FileService extends Disposable {
|
|
|
1109
1085
|
}
|
|
1110
1086
|
throwIfFileSystemIsReadonly(provider, resource) {
|
|
1111
1087
|
if (provider.capabilities & FileSystemProviderCapabilities.Readonly) {
|
|
1112
|
-
throw ( (new FileOperationError(
|
|
1113
|
-
|
|
1114
|
-
25,
|
|
1088
|
+
throw ( (new FileOperationError(localize(
|
|
1089
|
+
636,
|
|
1115
1090
|
"Unable to modify read-only file '{0}'",
|
|
1116
1091
|
this.resourceForError(resource)
|
|
1117
1092
|
), FileOperationResult.FILE_PERMISSION_DENIED)));
|
|
@@ -1120,9 +1095,8 @@ let FileService = class FileService extends Disposable {
|
|
|
1120
1095
|
}
|
|
1121
1096
|
throwIfFileIsReadonly(resource, stat) {
|
|
1122
1097
|
if ((stat.permissions ?? 0) & FilePermission.Readonly) {
|
|
1123
|
-
throw ( (new FileOperationError(
|
|
1124
|
-
|
|
1125
|
-
25,
|
|
1098
|
+
throw ( (new FileOperationError(localize(
|
|
1099
|
+
636,
|
|
1126
1100
|
"Unable to modify read-only file '{0}'",
|
|
1127
1101
|
this.resourceForError(resource)
|
|
1128
1102
|
), FileOperationResult.FILE_PERMISSION_DENIED)));
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
|
|
2
2
|
import { canceled } from 'vscode/vscode/vs/base/common/errors';
|
|
3
|
-
import {
|
|
3
|
+
import { localize } 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";
|
|
7
6
|
async function readFileIntoStream(provider, resource, target, transformer, options, token) {
|
|
8
7
|
let error = undefined;
|
|
9
8
|
try {
|
|
@@ -70,7 +69,7 @@ function throwIfCancelled(token) {
|
|
|
70
69
|
}
|
|
71
70
|
function throwIfTooLarge(totalBytesRead, options) {
|
|
72
71
|
if (typeof options?.limits?.size === 'number' && totalBytesRead > options.limits.size) {
|
|
73
|
-
throw createFileSystemProviderError(
|
|
72
|
+
throw createFileSystemProviderError(localize(4554, "File is too large to open"), FileSystemProviderErrorCode.FileTooLarge);
|
|
74
73
|
}
|
|
75
74
|
return true;
|
|
76
75
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import {
|
|
2
|
+
import { localize } from 'vscode/vscode/vs/nls';
|
|
3
3
|
import { TextFileEditorModelState, TextFileOperationError, TextFileOperationResult, toBufferOrReadable, stringToSnapshot } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles';
|
|
4
4
|
import { SaveSourceRegistry } from 'vscode/vscode/vs/workbench/common/editor';
|
|
5
5
|
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
@@ -51,11 +51,10 @@ import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
|
51
51
|
import { firstOrDefault } from 'vscode/vscode/vs/base/common/arrays';
|
|
52
52
|
|
|
53
53
|
var AbstractTextFileService_1;
|
|
54
|
-
const _moduleId = "vs/workbench/services/textfile/browser/textFileService";
|
|
55
54
|
let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
56
55
|
static { AbstractTextFileService_1 = this; }
|
|
57
|
-
static { this.TEXTFILE_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource('textFileCreate.source', (
|
|
58
|
-
static { this.TEXTFILE_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource('textFileOverwrite.source', (
|
|
56
|
+
static { this.TEXTFILE_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource('textFileCreate.source', ( localize(4555, "File Created"))); }
|
|
57
|
+
static { this.TEXTFILE_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource('textFileOverwrite.source', ( localize(4556, "File Replaced"))); }
|
|
59
58
|
constructor(fileService, untitledTextEditorService, lifecycleService, instantiationService, modelService, environmentService, dialogService, fileDialogService, textResourceConfigurationService, filesConfigurationService, codeEditorService, pathService, workingCopyFileService, uriIdentityService, languageService, logService, elevatedFileService, decorationsService) {
|
|
60
59
|
super();
|
|
61
60
|
this.fileService = fileService;
|
|
@@ -85,7 +84,7 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
85
84
|
constructor(files) {
|
|
86
85
|
super();
|
|
87
86
|
this.files = files;
|
|
88
|
-
this.label = (
|
|
87
|
+
this.label = ( localize(4557, "Text File Model Decorations"));
|
|
89
88
|
this._onDidChange = this._register(( (new Emitter())));
|
|
90
89
|
this.onDidChange = this._onDidChange.event;
|
|
91
90
|
this.registerListeners();
|
|
@@ -112,20 +111,20 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
112
111
|
color: listErrorForeground,
|
|
113
112
|
letter: Codicon.lockSmall,
|
|
114
113
|
strikethrough: true,
|
|
115
|
-
tooltip: (
|
|
114
|
+
tooltip: ( localize(4558, "Deleted, Read-only")),
|
|
116
115
|
};
|
|
117
116
|
}
|
|
118
117
|
else if (isReadonly) {
|
|
119
118
|
return {
|
|
120
119
|
letter: Codicon.lockSmall,
|
|
121
|
-
tooltip: (
|
|
120
|
+
tooltip: ( localize(4559, "Read-only")),
|
|
122
121
|
};
|
|
123
122
|
}
|
|
124
123
|
else if (isOrphaned) {
|
|
125
124
|
return {
|
|
126
125
|
color: listErrorForeground,
|
|
127
126
|
strikethrough: true,
|
|
128
|
-
tooltip: (
|
|
127
|
+
tooltip: ( localize(4560, "Deleted")),
|
|
129
128
|
};
|
|
130
129
|
}
|
|
131
130
|
return undefined;
|
|
@@ -179,7 +178,7 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
179
178
|
cts.dispose(true);
|
|
180
179
|
if (error.decodeStreamErrorKind === DecodeStreamErrorKind.STREAM_IS_BINARY) {
|
|
181
180
|
throw ( (new TextFileOperationError(
|
|
182
|
-
|
|
181
|
+
localize(4561, "File seems to be binary and cannot be opened as text"),
|
|
183
182
|
TextFileOperationResult.FILE_IS_BINARY,
|
|
184
183
|
options
|
|
185
184
|
)));
|
|
@@ -396,34 +395,31 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
396
395
|
async confirmOverwrite(resource) {
|
|
397
396
|
const { confirmed } = await this.dialogService.confirm({
|
|
398
397
|
type: 'warning',
|
|
399
|
-
message: (
|
|
400
|
-
|
|
401
|
-
7,
|
|
398
|
+
message: ( localize(
|
|
399
|
+
4562,
|
|
402
400
|
"'{0}' already exists. Do you want to replace it?",
|
|
403
401
|
basename(resource)
|
|
404
402
|
)),
|
|
405
|
-
detail: (
|
|
406
|
-
|
|
407
|
-
8,
|
|
403
|
+
detail: ( localize(
|
|
404
|
+
4563,
|
|
408
405
|
"A file or folder with the name '{0}' already exists in the folder '{1}'. Replacing it will overwrite its current contents.",
|
|
409
406
|
basename(resource),
|
|
410
407
|
basename(dirname(resource))
|
|
411
408
|
)),
|
|
412
|
-
primaryButton: (
|
|
409
|
+
primaryButton: ( localize(4564, "&&Replace")),
|
|
413
410
|
});
|
|
414
411
|
return confirmed;
|
|
415
412
|
}
|
|
416
413
|
async confirmMakeWriteable(resource) {
|
|
417
414
|
const { confirmed } = await this.dialogService.confirm({
|
|
418
415
|
type: 'warning',
|
|
419
|
-
message: (
|
|
420
|
-
|
|
421
|
-
10,
|
|
416
|
+
message: ( localize(
|
|
417
|
+
4565,
|
|
422
418
|
"'{0}' is marked as read-only. Do you want to save anyway?",
|
|
423
419
|
basename(resource)
|
|
424
420
|
)),
|
|
425
|
-
detail: (
|
|
426
|
-
primaryButton: (
|
|
421
|
+
detail: ( localize(4566, "Paths can be configured as read-only via settings.")),
|
|
422
|
+
primaryButton: ( localize(4567, "&&Save Anyway"))
|
|
427
423
|
});
|
|
428
424
|
return confirmed;
|
|
429
425
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import {
|
|
2
|
+
import { localize } from 'vscode/vscode/vs/nls';
|
|
3
3
|
import { toErrorMessage } from 'vscode/vscode/vs/base/common/errorMessage';
|
|
4
4
|
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
5
5
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
@@ -19,7 +19,6 @@ import { createTextBufferFactoryFromSnapshot } from 'vscode/vscode/vs/editor/com
|
|
|
19
19
|
import { PLAINTEXT_LANGUAGE_ID, PLAINTEXT_EXTENSION } from 'vscode/vscode/vs/editor/common/languages/modesRegistry';
|
|
20
20
|
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
21
21
|
|
|
22
|
-
const _moduleId = "vs/workbench/services/textfile/common/textFileEditorModelManager";
|
|
23
22
|
let TextFileEditorModelManager = class TextFileEditorModelManager extends Disposable {
|
|
24
23
|
get models() {
|
|
25
24
|
return [...( (this.mapResourceToModel.values()))];
|
|
@@ -62,9 +61,8 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
62
61
|
const notificationService = this.notificationService;
|
|
63
62
|
return {
|
|
64
63
|
onSaveError(error, model) {
|
|
65
|
-
notificationService.error((
|
|
66
|
-
|
|
67
|
-
0,
|
|
64
|
+
notificationService.error(( localize(
|
|
65
|
+
9821,
|
|
68
66
|
"Failed to save '{0}': {1}",
|
|
69
67
|
model.name,
|
|
70
68
|
toErrorMessage(error, false)
|