@codingame/monaco-vscode-files-service-override 18.4.0 → 19.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -1
- package/index.js +3 -3
- package/package.json +9 -10
- package/vscode/src/vs/platform/files/browser/indexedDBFileSystemProvider.js +6 -6
- package/vscode/src/vs/platform/files/common/fileService.d.ts +1 -0
- package/vscode/src/vs/platform/files/common/fileService.js +36 -28
- package/vscode/src/vs/platform/files/common/io.js +1 -1
- package/vscode/src/vs/workbench/services/textfile/browser/textFileService.js +14 -14
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModelManager.js +1 -1
- package/vscode/src/vs/workbench/services/textfile/common/textFileSaveParticipant.js +2 -2
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IEditorOverrideServices } from "@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices";
|
|
2
|
-
import { InMemoryFileSystemProvider } from "@codingame/monaco-vscode-
|
|
2
|
+
import { InMemoryFileSystemProvider } from "@codingame/monaco-vscode-2f06fe84-148e-5e6b-a7ca-c7989c5f128a-common/vscode/vs/platform/files/common/inMemoryFilesystemProvider";
|
|
3
3
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
4
4
|
import { FileChangeType, FilePermission, FileSystemProviderCapabilities, FileType, type IFileSystemProvider, FileSystemProviderError, FileSystemProviderErrorCode, type IFileChange, type IFileDeleteOptions, type IFileOverwriteOptions, type IFileSystemProviderWithFileReadWriteCapability, type IFileWriteOptions, type IStat, type IWatchOptions, type IFileSystemProviderWithOpenReadWriteCloseCapability, type IFileSystemProviderWithFileReadStreamCapability, type IFileReadStreamOptions, type IFileSystemProviderWithFileAtomicReadCapability, type IFileSystemProviderWithFileAtomicWriteCapability, type IFileSystemProviderWithFileAtomicDeleteCapability } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files";
|
|
5
5
|
import { type IDisposable, Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
package/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/
|
|
|
4
4
|
import { mkdirp, FileService } from './vscode/src/vs/platform/files/common/fileService.js';
|
|
5
5
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log';
|
|
6
6
|
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
7
|
-
import { InMemoryFileSystemProvider } from '@codingame/monaco-vscode-
|
|
8
|
-
export { InMemoryFileSystemProvider } from '@codingame/monaco-vscode-
|
|
7
|
+
import { InMemoryFileSystemProvider } from '@codingame/monaco-vscode-2f06fe84-148e-5e6b-a7ca-c7989c5f128a-common/vscode/vs/platform/files/common/inMemoryFilesystemProvider';
|
|
8
|
+
export { InMemoryFileSystemProvider } from '@codingame/monaco-vscode-2f06fe84-148e-5e6b-a7ca-c7989c5f128a-common/vscode/vs/platform/files/common/inMemoryFilesystemProvider';
|
|
9
9
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
10
10
|
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
11
11
|
import { FileType, FilePermission, createFileSystemProviderError, FileSystemProviderErrorCode, FileSystemProviderCapabilities, FileChangeType, FileSystemProviderError, hasFileReadStreamCapability } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
|
|
@@ -22,7 +22,7 @@ export { IndexedDB } from '@codingame/monaco-vscode-2f06fe84-148e-5e6b-a7ca-c798
|
|
|
22
22
|
import { BufferLogger } from '@codingame/monaco-vscode-cea4d01f-6526-5c2f-8b09-b168fead499f-common/vscode/vs/platform/log/common/bufferLog';
|
|
23
23
|
import { ITextFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/textfile/common/textfiles.service';
|
|
24
24
|
import { BrowserTextFileService } from './vscode/src/vs/workbench/services/textfile/browser/browserTextFileService.js';
|
|
25
|
-
import { FilesConfigurationService } from '@codingame/monaco-vscode-
|
|
25
|
+
import { FilesConfigurationService } from '@codingame/monaco-vscode-86d65fc6-30f9-5dca-9501-e249de688591-common/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService';
|
|
26
26
|
import { IFilesConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service';
|
|
27
27
|
import { BrowserElevatedFileService } from './vscode/src/vs/workbench/services/files/browser/elevatedFileService.js';
|
|
28
28
|
import { IElevatedFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/files/common/elevatedFileService.service';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-files-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - files service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,15 +15,14 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-0c06bfba-d24d-5c4d-90cd-b40cefb7f811-common": "
|
|
19
|
-
"@codingame/monaco-vscode-15626ec7-b165-51e1-8caf-7bcc2ae9b95a-common": "
|
|
20
|
-
"@codingame/monaco-vscode-2f06fe84-148e-5e6b-a7ca-c7989c5f128a-common": "
|
|
21
|
-
"@codingame/monaco-vscode-60014c9d-b815-501d-83a9-4b08725c2ec2-common": "
|
|
22
|
-
"@codingame/monaco-vscode-
|
|
23
|
-
"@codingame/monaco-vscode-
|
|
24
|
-
"@codingame/monaco-vscode-
|
|
25
|
-
"@codingame/monaco-vscode-cea4d01f-6526-5c2f-8b09-b168fead499f-common": "
|
|
26
|
-
"@codingame/monaco-vscode-ed7f2efb-131f-5ae8-b8fe-f20867e14c58-common": "18.4.0"
|
|
18
|
+
"@codingame/monaco-vscode-0c06bfba-d24d-5c4d-90cd-b40cefb7f811-common": "19.0.0",
|
|
19
|
+
"@codingame/monaco-vscode-15626ec7-b165-51e1-8caf-7bcc2ae9b95a-common": "19.0.0",
|
|
20
|
+
"@codingame/monaco-vscode-2f06fe84-148e-5e6b-a7ca-c7989c5f128a-common": "19.0.0",
|
|
21
|
+
"@codingame/monaco-vscode-60014c9d-b815-501d-83a9-4b08725c2ec2-common": "19.0.0",
|
|
22
|
+
"@codingame/monaco-vscode-86d65fc6-30f9-5dca-9501-e249de688591-common": "19.0.0",
|
|
23
|
+
"@codingame/monaco-vscode-api": "19.0.0",
|
|
24
|
+
"@codingame/monaco-vscode-ca445022-b812-53ca-a041-e46c7e0b13de-common": "19.0.0",
|
|
25
|
+
"@codingame/monaco-vscode-cea4d01f-6526-5c2f-8b09-b168fead499f-common": "19.0.0"
|
|
27
26
|
},
|
|
28
27
|
"main": "index.js",
|
|
29
28
|
"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-60014c9d-b815-501d-83a9-4b08725c2ec2-common/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(1863, "File does not exist")), FileSystemProviderErrorCode.FileNotFound);
|
|
14
|
+
const ERR_FILE_IS_DIR = createFileSystemProviderError(( localize(1864, "File is Directory")), FileSystemProviderErrorCode.FileIsADirectory);
|
|
15
|
+
const ERR_FILE_NOT_DIR = createFileSystemProviderError(( localize(1865, "File is not a directory")), FileSystemProviderErrorCode.FileNotADirectory);
|
|
16
|
+
const ERR_DIR_NOT_EMPTY = createFileSystemProviderError(( localize(1866, "Directory is not empty")), FileSystemProviderErrorCode.Unknown);
|
|
17
|
+
const ERR_FILE_EXCEEDS_STORAGE_QUOTA = createFileSystemProviderError(( localize(1867, "File exceeds available storage quota")), FileSystemProviderErrorCode.FileExceedsStorageQuota);
|
|
18
18
|
const ERR_UNKNOWN_INTERNAL = (message) => createFileSystemProviderError(( localize(
|
|
19
|
-
|
|
19
|
+
1868,
|
|
20
20
|
"Internal error occurred in IndexedDB File System Provider. ({0})",
|
|
21
21
|
message
|
|
22
22
|
)), FileSystemProviderErrorCode.Unknown);
|
|
@@ -47,6 +47,7 @@ export declare class FileService extends Disposable implements IFileService {
|
|
|
47
47
|
options: IResolveMetadataFileOptions;
|
|
48
48
|
}[]): Promise<IFileStatResultWithMetadata[]>;
|
|
49
49
|
stat(resource: URI): Promise<IFileStatWithPartialMetadata>;
|
|
50
|
+
realpath(resource: URI): Promise<URI | undefined>;
|
|
50
51
|
exists(resource: URI): Promise<boolean>;
|
|
51
52
|
canCreateFile(resource: URI, options?: ICreateFileOptions): Promise<Error | true>;
|
|
52
53
|
private doValidateCreateFile;
|
|
@@ -14,7 +14,7 @@ import { mark } from '@codingame/monaco-vscode-api/vscode/vs/base/common/perform
|
|
|
14
14
|
import { isAbsolutePath, extUri, extUriIgnorePathCase } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
15
15
|
import { isReadableStream, peekStream, peekReadable, consumeStream, transform, newWriteableStream, isReadableBufferedStream, listenStream } from '@codingame/monaco-vscode-api/vscode/vs/base/common/stream';
|
|
16
16
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
17
|
-
import { FileType, toFileSystemProviderErrorCode, FileSystemProviderErrorCode, FileChangesEvent, FileOperationError, FileOperationResult, hasOpenReadWriteCloseCapability, hasReadWriteCapability, hasFileReadStreamCapability, ensureFileSystemProviderError, etag, FilePermission, FileSystemProviderCapabilities, FileOperationEvent, FileOperation, hasFileAtomicWriteCapability, toFileOperationResult, ETAG_DISABLED, hasFileAtomicReadCapability, NotModifiedSinceFileOperationError, TooLargeFileOperationError, hasFileFolderCopyCapability, hasFileAtomicDeleteCapability, hasFileCloneCapability } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
|
|
17
|
+
import { FileType, toFileSystemProviderErrorCode, FileSystemProviderErrorCode, FileChangesEvent, FileOperationError, FileOperationResult, hasOpenReadWriteCloseCapability, hasReadWriteCapability, hasFileReadStreamCapability, ensureFileSystemProviderError, etag, FilePermission, FileSystemProviderCapabilities, hasFileRealpathCapability, FileOperationEvent, FileOperation, hasFileAtomicWriteCapability, toFileOperationResult, ETAG_DISABLED, hasFileAtomicReadCapability, NotModifiedSinceFileOperationError, TooLargeFileOperationError, hasFileFolderCopyCapability, hasFileAtomicDeleteCapability, hasFileCloneCapability } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
|
|
18
18
|
import { readFileIntoStream } from './io.js';
|
|
19
19
|
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
20
20
|
import { ErrorNoTelemetry } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
@@ -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
|
+
1869,
|
|
37
37
|
"Unable to create folder '{0}' that already exists but is not a directory",
|
|
38
38
|
resourceForError(directory)
|
|
39
39
|
))));
|
|
@@ -144,7 +144,7 @@ let FileService = class FileService extends Disposable {
|
|
|
144
144
|
async withProvider(resource) {
|
|
145
145
|
if (!isAbsolutePath(resource)) {
|
|
146
146
|
throw ( new FileOperationError(( localize(
|
|
147
|
-
|
|
147
|
+
1870,
|
|
148
148
|
"Unable to resolve filesystem provider with relative file path '{0}'",
|
|
149
149
|
this.resourceForError(resource)
|
|
150
150
|
)), FileOperationResult.FILE_INVALID_PATH));
|
|
@@ -154,7 +154,7 @@ let FileService = class FileService extends Disposable {
|
|
|
154
154
|
if (!provider) {
|
|
155
155
|
const error = ( new ErrorNoTelemetry());
|
|
156
156
|
error.message = ( localize(
|
|
157
|
-
|
|
157
|
+
1871,
|
|
158
158
|
"ENOPRO: No file system provider found for resource '{0}'",
|
|
159
159
|
(resource.toString())
|
|
160
160
|
));
|
|
@@ -187,7 +187,7 @@ let FileService = class FileService extends Disposable {
|
|
|
187
187
|
catch (error) {
|
|
188
188
|
if (toFileSystemProviderErrorCode(error) === FileSystemProviderErrorCode.FileNotFound) {
|
|
189
189
|
throw ( new FileOperationError(( localize(
|
|
190
|
-
|
|
190
|
+
1872,
|
|
191
191
|
"Unable to resolve nonexistent file '{0}'",
|
|
192
192
|
this.resourceForError(resource)
|
|
193
193
|
)), FileOperationResult.FILE_NOT_FOUND));
|
|
@@ -276,6 +276,14 @@ let FileService = class FileService extends Disposable {
|
|
|
276
276
|
const stat = await provider.stat(resource);
|
|
277
277
|
return this.toFileStat(provider, resource, stat, undefined, true, () => false );
|
|
278
278
|
}
|
|
279
|
+
async realpath(resource) {
|
|
280
|
+
const provider = await this.withProvider(resource);
|
|
281
|
+
if (hasFileRealpathCapability(provider)) {
|
|
282
|
+
const realpath = await provider.realpath(resource);
|
|
283
|
+
return resource.with({ path: realpath });
|
|
284
|
+
}
|
|
285
|
+
return undefined;
|
|
286
|
+
}
|
|
279
287
|
async exists(resource) {
|
|
280
288
|
const provider = await this.withProvider(resource);
|
|
281
289
|
try {
|
|
@@ -298,7 +306,7 @@ let FileService = class FileService extends Disposable {
|
|
|
298
306
|
async doValidateCreateFile(resource, options) {
|
|
299
307
|
if (!options?.overwrite && (await this.exists(resource))) {
|
|
300
308
|
throw ( new FileOperationError(( localize(
|
|
301
|
-
|
|
309
|
+
1873,
|
|
302
310
|
"Unable to create file '{0}' that already exists when overwrite flag is not set",
|
|
303
311
|
this.resourceForError(resource)
|
|
304
312
|
)), FileOperationResult.FILE_MODIFIED_SINCE, options));
|
|
@@ -341,7 +349,7 @@ let FileService = class FileService extends Disposable {
|
|
|
341
349
|
}
|
|
342
350
|
catch (error) {
|
|
343
351
|
throw ( new FileOperationError(( localize(
|
|
344
|
-
|
|
352
|
+
1874,
|
|
345
353
|
"Unable to write file '{0}' ({1})",
|
|
346
354
|
this.resourceForError(resource),
|
|
347
355
|
(ensureFileSystemProviderError(error).toString())
|
|
@@ -374,7 +382,7 @@ let FileService = class FileService extends Disposable {
|
|
|
374
382
|
const unlock = !!options?.unlock;
|
|
375
383
|
if (unlock && !(provider.capabilities & FileSystemProviderCapabilities.FileWriteUnlock)) {
|
|
376
384
|
throw ( new Error(( localize(
|
|
377
|
-
|
|
385
|
+
1875,
|
|
378
386
|
"Unable to unlock file '{0}' because provider does not support it.",
|
|
379
387
|
this.resourceForError(resource)
|
|
380
388
|
))));
|
|
@@ -383,21 +391,21 @@ let FileService = class FileService extends Disposable {
|
|
|
383
391
|
if (atomic) {
|
|
384
392
|
if (!(provider.capabilities & FileSystemProviderCapabilities.FileAtomicWrite)) {
|
|
385
393
|
throw ( new Error(( localize(
|
|
386
|
-
|
|
394
|
+
1876,
|
|
387
395
|
"Unable to atomically write file '{0}' because provider does not support it.",
|
|
388
396
|
this.resourceForError(resource)
|
|
389
397
|
))));
|
|
390
398
|
}
|
|
391
399
|
if (!(provider.capabilities & FileSystemProviderCapabilities.FileReadWrite)) {
|
|
392
400
|
throw ( new Error(( localize(
|
|
393
|
-
|
|
401
|
+
1877,
|
|
394
402
|
"Unable to atomically write file '{0}' because provider does not support unbuffered writes.",
|
|
395
403
|
this.resourceForError(resource)
|
|
396
404
|
))));
|
|
397
405
|
}
|
|
398
406
|
if (unlock) {
|
|
399
407
|
throw ( new Error(( localize(
|
|
400
|
-
|
|
408
|
+
1878,
|
|
401
409
|
"Unable to unlock file '{0}' because atomic write is enabled.",
|
|
402
410
|
this.resourceForError(resource)
|
|
403
411
|
))));
|
|
@@ -412,7 +420,7 @@ let FileService = class FileService extends Disposable {
|
|
|
412
420
|
}
|
|
413
421
|
if ((stat.type & FileType.Directory) !== 0) {
|
|
414
422
|
throw ( new FileOperationError(( localize(
|
|
415
|
-
|
|
423
|
+
1879,
|
|
416
424
|
"Unable to write file '{0}' that is actually a directory",
|
|
417
425
|
this.resourceForError(resource)
|
|
418
426
|
)), FileOperationResult.FILE_IS_DIRECTORY, options));
|
|
@@ -433,7 +441,7 @@ let FileService = class FileService extends Disposable {
|
|
|
433
441
|
catch (error) {
|
|
434
442
|
}
|
|
435
443
|
}
|
|
436
|
-
throw ( new FileOperationError(( localize(
|
|
444
|
+
throw ( new FileOperationError(( localize(1880, "File Modified Since")), FileOperationResult.FILE_MODIFIED_SINCE, options));
|
|
437
445
|
}
|
|
438
446
|
return { stat, buffer };
|
|
439
447
|
}
|
|
@@ -515,7 +523,7 @@ let FileService = class FileService extends Disposable {
|
|
|
515
523
|
}
|
|
516
524
|
restoreReadError(error, resource, options) {
|
|
517
525
|
const message = ( localize(
|
|
518
|
-
|
|
526
|
+
1881,
|
|
519
527
|
"Unable to read file '{0}' ({1})",
|
|
520
528
|
this.resourceForError(resource),
|
|
521
529
|
(ensureFileSystemProviderError(error).toString())
|
|
@@ -575,13 +583,13 @@ let FileService = class FileService extends Disposable {
|
|
|
575
583
|
const stat = await this.resolve(resource, { resolveMetadata: true });
|
|
576
584
|
if (stat.isDirectory) {
|
|
577
585
|
throw ( new FileOperationError(( localize(
|
|
578
|
-
|
|
586
|
+
1882,
|
|
579
587
|
"Unable to read file '{0}' that is actually a directory",
|
|
580
588
|
this.resourceForError(resource)
|
|
581
589
|
)), FileOperationResult.FILE_IS_DIRECTORY, options));
|
|
582
590
|
}
|
|
583
591
|
if (typeof options?.etag === 'string' && options.etag !== ETAG_DISABLED && options.etag === stat.etag) {
|
|
584
|
-
throw ( new NotModifiedSinceFileOperationError(( localize(
|
|
592
|
+
throw ( new NotModifiedSinceFileOperationError(( localize(1883, "File not modified since")), stat, options));
|
|
585
593
|
}
|
|
586
594
|
this.validateReadFileLimits(resource, stat.size, options);
|
|
587
595
|
return stat;
|
|
@@ -589,7 +597,7 @@ let FileService = class FileService extends Disposable {
|
|
|
589
597
|
validateReadFileLimits(resource, size, options) {
|
|
590
598
|
if (typeof options?.limits?.size === 'number' && size > options.limits.size) {
|
|
591
599
|
throw ( new TooLargeFileOperationError(( localize(
|
|
592
|
-
|
|
600
|
+
1884,
|
|
593
601
|
"Unable to read file '{0}' that is too large to open",
|
|
594
602
|
this.resourceForError(resource)
|
|
595
603
|
)), FileOperationResult.FILE_TOO_LARGE, size, options));
|
|
@@ -711,7 +719,7 @@ let FileService = class FileService extends Disposable {
|
|
|
711
719
|
}
|
|
712
720
|
if (isSameResourceWithDifferentPathCase && mode === 'copy') {
|
|
713
721
|
throw ( new Error(( localize(
|
|
714
|
-
|
|
722
|
+
1885,
|
|
715
723
|
"Unable to copy when source '{0}' is same as target '{1}' with different path case on a case insensitive file system",
|
|
716
724
|
this.resourceForError(source),
|
|
717
725
|
this.resourceForError(target)
|
|
@@ -719,7 +727,7 @@ let FileService = class FileService extends Disposable {
|
|
|
719
727
|
}
|
|
720
728
|
if (!isSameResourceWithDifferentPathCase && providerExtUri.isEqualOrParent(target, source)) {
|
|
721
729
|
throw ( new Error(( localize(
|
|
722
|
-
|
|
730
|
+
1886,
|
|
723
731
|
"Unable to move/copy when source '{0}' is parent of target '{1}'.",
|
|
724
732
|
this.resourceForError(source),
|
|
725
733
|
this.resourceForError(target)
|
|
@@ -730,7 +738,7 @@ let FileService = class FileService extends Disposable {
|
|
|
730
738
|
if (exists && !isSameResourceWithDifferentPathCase) {
|
|
731
739
|
if (!overwrite) {
|
|
732
740
|
throw ( new FileOperationError(( localize(
|
|
733
|
-
|
|
741
|
+
1887,
|
|
734
742
|
"Unable to move/copy '{0}' because target '{1}' already exists at destination.",
|
|
735
743
|
this.resourceForError(source),
|
|
736
744
|
this.resourceForError(target)
|
|
@@ -740,7 +748,7 @@ let FileService = class FileService extends Disposable {
|
|
|
740
748
|
const { providerExtUri } = this.getExtUri(sourceProvider);
|
|
741
749
|
if (providerExtUri.isEqualOrParent(source, target)) {
|
|
742
750
|
throw ( new Error(( localize(
|
|
743
|
-
|
|
751
|
+
1888,
|
|
744
752
|
"Unable to move/copy '{0}' into '{1}' since a file would replace the folder it is contained in.",
|
|
745
753
|
this.resourceForError(source),
|
|
746
754
|
this.resourceForError(target)
|
|
@@ -785,7 +793,7 @@ let FileService = class FileService extends Disposable {
|
|
|
785
793
|
const useTrash = !!options?.useTrash;
|
|
786
794
|
if (useTrash && !(provider.capabilities & FileSystemProviderCapabilities.Trash)) {
|
|
787
795
|
throw ( new Error(( localize(
|
|
788
|
-
|
|
796
|
+
1889,
|
|
789
797
|
"Unable to delete file '{0}' via trash because provider does not support it.",
|
|
790
798
|
this.resourceForError(resource)
|
|
791
799
|
))));
|
|
@@ -793,14 +801,14 @@ let FileService = class FileService extends Disposable {
|
|
|
793
801
|
const atomic = options?.atomic;
|
|
794
802
|
if (atomic && !(provider.capabilities & FileSystemProviderCapabilities.FileAtomicDelete)) {
|
|
795
803
|
throw ( new Error(( localize(
|
|
796
|
-
|
|
804
|
+
1890,
|
|
797
805
|
"Unable to delete file '{0}' atomically because provider does not support it.",
|
|
798
806
|
this.resourceForError(resource)
|
|
799
807
|
))));
|
|
800
808
|
}
|
|
801
809
|
if (useTrash && atomic) {
|
|
802
810
|
throw ( new Error(( localize(
|
|
803
|
-
|
|
811
|
+
1891,
|
|
804
812
|
"Unable to atomically delete file '{0}' because using trash is enabled.",
|
|
805
813
|
this.resourceForError(resource)
|
|
806
814
|
))));
|
|
@@ -816,7 +824,7 @@ let FileService = class FileService extends Disposable {
|
|
|
816
824
|
}
|
|
817
825
|
else {
|
|
818
826
|
throw ( new FileOperationError(( localize(
|
|
819
|
-
|
|
827
|
+
1892,
|
|
820
828
|
"Unable to delete nonexistent file '{0}'",
|
|
821
829
|
this.resourceForError(resource)
|
|
822
830
|
)), FileOperationResult.FILE_NOT_FOUND));
|
|
@@ -826,7 +834,7 @@ let FileService = class FileService extends Disposable {
|
|
|
826
834
|
const stat = await this.resolve(resource);
|
|
827
835
|
if (stat.isDirectory && Array.isArray(stat.children) && stat.children.length > 0) {
|
|
828
836
|
throw ( new Error(( localize(
|
|
829
|
-
|
|
837
|
+
1893,
|
|
830
838
|
"Unable to delete non-empty folder '{0}'.",
|
|
831
839
|
this.resourceForError(resource)
|
|
832
840
|
))));
|
|
@@ -1085,7 +1093,7 @@ let FileService = class FileService extends Disposable {
|
|
|
1085
1093
|
throwIfFileSystemIsReadonly(provider, resource) {
|
|
1086
1094
|
if (provider.capabilities & FileSystemProviderCapabilities.Readonly) {
|
|
1087
1095
|
throw ( new FileOperationError(( localize(
|
|
1088
|
-
|
|
1096
|
+
1894,
|
|
1089
1097
|
"Unable to modify read-only file '{0}'",
|
|
1090
1098
|
this.resourceForError(resource)
|
|
1091
1099
|
)), FileOperationResult.FILE_PERMISSION_DENIED));
|
|
@@ -1095,7 +1103,7 @@ let FileService = class FileService extends Disposable {
|
|
|
1095
1103
|
throwIfFileIsReadonly(resource, stat) {
|
|
1096
1104
|
if ((stat.permissions ?? 0) & FilePermission.Readonly) {
|
|
1097
1105
|
throw ( new FileOperationError(( localize(
|
|
1098
|
-
|
|
1106
|
+
1894,
|
|
1099
1107
|
"Unable to modify read-only file '{0}'",
|
|
1100
1108
|
this.resourceForError(resource)
|
|
1101
1109
|
)), FileOperationResult.FILE_PERMISSION_DENIED));
|
|
@@ -70,7 +70,7 @@ function throwIfCancelled(token) {
|
|
|
70
70
|
}
|
|
71
71
|
function throwIfTooLarge(totalBytesRead, options) {
|
|
72
72
|
if (typeof options?.limits?.size === 'number' && totalBytesRead > options.limits.size) {
|
|
73
|
-
throw createFileSystemProviderError(( localize(
|
|
73
|
+
throw createFileSystemProviderError(( localize(1901, "File is too large to open")), FileSystemProviderErrorCode.FileTooLarge);
|
|
74
74
|
}
|
|
75
75
|
return true;
|
|
76
76
|
}
|
|
@@ -22,7 +22,7 @@ import { bufferToStream } from '@codingame/monaco-vscode-api/vscode/vs/base/comm
|
|
|
22
22
|
import { ITextResourceConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration.service';
|
|
23
23
|
import { PLAINTEXT_LANGUAGE_ID } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/modesRegistry';
|
|
24
24
|
import { IFilesConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service';
|
|
25
|
-
import { BaseTextEditorModel } from '@codingame/monaco-vscode-
|
|
25
|
+
import { BaseTextEditorModel } from '@codingame/monaco-vscode-ca445022-b812-53ca-a041-e46c7e0b13de-common/vscode/vs/workbench/common/editor/textEditorModel';
|
|
26
26
|
import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service';
|
|
27
27
|
import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service';
|
|
28
28
|
import { IWorkingCopyFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service';
|
|
@@ -53,8 +53,8 @@ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/sear
|
|
|
53
53
|
var AbstractTextFileService_1;
|
|
54
54
|
let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
55
55
|
static { AbstractTextFileService_1 = this; }
|
|
56
|
-
static { this.TEXTFILE_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource('textFileCreate.source', ( localize(
|
|
57
|
-
static { this.TEXTFILE_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource('textFileOverwrite.source', ( localize(
|
|
56
|
+
static { this.TEXTFILE_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource('textFileCreate.source', ( localize(13164, "File Created"))); }
|
|
57
|
+
static { this.TEXTFILE_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource('textFileOverwrite.source', ( localize(13165, "File Replaced"))); }
|
|
58
58
|
constructor(fileService, untitledTextEditorService, lifecycleService, instantiationService, modelService, environmentService, dialogService, fileDialogService, textResourceConfigurationService, filesConfigurationService, codeEditorService, pathService, workingCopyFileService, uriIdentityService, languageService, logService, elevatedFileService, decorationsService) {
|
|
59
59
|
super();
|
|
60
60
|
this.fileService = fileService;
|
|
@@ -83,7 +83,7 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
83
83
|
constructor(files) {
|
|
84
84
|
super();
|
|
85
85
|
this.files = files;
|
|
86
|
-
this.label = ( localize(
|
|
86
|
+
this.label = ( localize(13166, "Text File Model Decorations"));
|
|
87
87
|
this._onDidChange = this._register(( new Emitter()));
|
|
88
88
|
this.onDidChange = this._onDidChange.event;
|
|
89
89
|
this.registerListeners();
|
|
@@ -110,20 +110,20 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
110
110
|
color: listErrorForeground,
|
|
111
111
|
letter: Codicon.lockSmall,
|
|
112
112
|
strikethrough: true,
|
|
113
|
-
tooltip: ( localize(
|
|
113
|
+
tooltip: ( localize(13167, "Deleted, Read-only")),
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
else if (isReadonly) {
|
|
117
117
|
return {
|
|
118
118
|
letter: Codicon.lockSmall,
|
|
119
|
-
tooltip: ( localize(
|
|
119
|
+
tooltip: ( localize(13168, "Read-only")),
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
122
|
else if (isOrphaned) {
|
|
123
123
|
return {
|
|
124
124
|
color: listErrorForeground,
|
|
125
125
|
strikethrough: true,
|
|
126
|
-
tooltip: ( localize(
|
|
126
|
+
tooltip: ( localize(13169, "Deleted")),
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
129
|
return undefined;
|
|
@@ -176,7 +176,7 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
176
176
|
catch (error) {
|
|
177
177
|
cts.dispose(true);
|
|
178
178
|
if (error.decodeStreamErrorKind === DecodeStreamErrorKind.STREAM_IS_BINARY) {
|
|
179
|
-
throw ( new TextFileOperationError(( localize(
|
|
179
|
+
throw ( new TextFileOperationError(( localize(13170, "File seems to be binary and cannot be opened as text")), TextFileOperationResult.FILE_IS_BINARY, options));
|
|
180
180
|
}
|
|
181
181
|
else {
|
|
182
182
|
throw error;
|
|
@@ -411,17 +411,17 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
411
411
|
const { confirmed } = await this.dialogService.confirm({
|
|
412
412
|
type: 'warning',
|
|
413
413
|
message: ( localize(
|
|
414
|
-
|
|
414
|
+
13171,
|
|
415
415
|
"'{0}' already exists. Do you want to replace it?",
|
|
416
416
|
basename(resource)
|
|
417
417
|
)),
|
|
418
418
|
detail: ( localize(
|
|
419
|
-
|
|
419
|
+
13172,
|
|
420
420
|
"A file or folder with the name '{0}' already exists in the folder '{1}'. Replacing it will overwrite its current contents.",
|
|
421
421
|
basename(resource),
|
|
422
422
|
basename(dirname(resource))
|
|
423
423
|
)),
|
|
424
|
-
primaryButton: ( localize(
|
|
424
|
+
primaryButton: ( localize(13173, "&&Replace")),
|
|
425
425
|
});
|
|
426
426
|
return confirmed;
|
|
427
427
|
}
|
|
@@ -429,12 +429,12 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
429
429
|
const { confirmed } = await this.dialogService.confirm({
|
|
430
430
|
type: 'warning',
|
|
431
431
|
message: ( localize(
|
|
432
|
-
|
|
432
|
+
13174,
|
|
433
433
|
"'{0}' is marked as read-only. Do you want to save anyway?",
|
|
434
434
|
basename(resource)
|
|
435
435
|
)),
|
|
436
|
-
detail: ( localize(
|
|
437
|
-
primaryButton: ( localize(
|
|
436
|
+
detail: ( localize(13175, "Paths can be configured as read-only via settings.")),
|
|
437
|
+
primaryButton: ( localize(13176, "&&Save Anyway"))
|
|
438
438
|
});
|
|
439
439
|
return confirmed;
|
|
440
440
|
}
|
|
@@ -63,7 +63,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
63
63
|
return {
|
|
64
64
|
onSaveError(error, model) {
|
|
65
65
|
notificationService.error(( localize(
|
|
66
|
-
|
|
66
|
+
13180,
|
|
67
67
|
"Failed to save '{0}': {1}",
|
|
68
68
|
model.name,
|
|
69
69
|
toErrorMessage(error, false)
|
|
@@ -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(13181, "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(13182, "Skip")),
|
|
36
36
|
delay: model.isDirty() ? 5000 : 3000
|
|
37
37
|
}, async (progress) => {
|
|
38
38
|
const participants = Array.from(this.saveParticipants).sort((a, b) => {
|