@codingame/monaco-vscode-files-service-override 14.0.5 → 15.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.js +1 -1
- package/package.json +14 -14
- package/vscode/src/vs/platform/files/browser/indexedDBFileSystemProvider.js +7 -7
- package/vscode/src/vs/platform/files/common/fileService.d.ts +4 -1
- package/vscode/src/vs/platform/files/common/fileService.js +66 -48
- package/vscode/src/vs/platform/files/common/io.js +1 -1
- package/vscode/src/vs/workbench/services/textfile/browser/browserTextFileService.d.ts +4 -4
- package/vscode/src/vs/workbench/services/textfile/browser/browserTextFileService.js +5 -5
- package/vscode/src/vs/workbench/services/textfile/browser/textFileService.d.ts +18 -16
- package/vscode/src/vs/workbench/services/textfile/browser/textFileService.js +33 -27
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModelManager.d.ts +1 -1
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModelManager.js +1 -1
- package/vscode/src/vs/workbench/services/textfile/common/textFileSaveParticipant.d.ts +1 -1
- package/vscode/src/vs/workbench/services/textfile/common/textFileSaveParticipant.js +8 -3
package/index.js
CHANGED
|
@@ -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": "15.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,15 @@
|
|
|
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-2e67e044-0db9-5fa6-8bd1-3737a7d586d4-common": "
|
|
21
|
-
"@codingame/monaco-vscode-2f06fe84-148e-5e6b-a7ca-c7989c5f128a-common": "
|
|
22
|
-
"@codingame/monaco-vscode-
|
|
23
|
-
"@codingame/monaco-vscode-
|
|
24
|
-
"@codingame/monaco-vscode-
|
|
25
|
-
"@codingame/monaco-vscode-
|
|
26
|
-
"@codingame/monaco-vscode-cea4d01f-6526-5c2f-8b09-b168fead499f-common": "
|
|
18
|
+
"@codingame/monaco-vscode-0c06bfba-d24d-5c4d-90cd-b40cefb7f811-common": "15.0.0",
|
|
19
|
+
"@codingame/monaco-vscode-15626ec7-b165-51e1-8caf-7bcc2ae9b95a-common": "15.0.0",
|
|
20
|
+
"@codingame/monaco-vscode-2e67e044-0db9-5fa6-8bd1-3737a7d586d4-common": "15.0.0",
|
|
21
|
+
"@codingame/monaco-vscode-2f06fe84-148e-5e6b-a7ca-c7989c5f128a-common": "15.0.0",
|
|
22
|
+
"@codingame/monaco-vscode-81f603ca-d6ea-5402-90dd-3014dffc63b4-common": "15.0.0",
|
|
23
|
+
"@codingame/monaco-vscode-86d65fc6-30f9-5dca-9501-e249de688591-common": "15.0.0",
|
|
24
|
+
"@codingame/monaco-vscode-aff8bc9b-c6f8-578f-9c8a-f70d14f9c13c-common": "15.0.0",
|
|
25
|
+
"@codingame/monaco-vscode-api": "15.0.0",
|
|
26
|
+
"@codingame/monaco-vscode-cea4d01f-6526-5c2f-8b09-b168fead499f-common": "15.0.0"
|
|
27
27
|
},
|
|
28
28
|
"main": "index.js",
|
|
29
29
|
"module": "index.js",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"default": "./index.js"
|
|
34
34
|
},
|
|
35
35
|
"./vscode/*": {
|
|
36
|
-
"
|
|
37
|
-
"
|
|
36
|
+
"types": "./vscode/src/*.d.ts",
|
|
37
|
+
"default": "./vscode/src/*.js"
|
|
38
38
|
},
|
|
39
39
|
"./*": {
|
|
40
|
-
"
|
|
41
|
-
"
|
|
40
|
+
"types": "./*.d.ts",
|
|
41
|
+
"default": "./*.js"
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"typesVersions": {
|
|
@@ -8,15 +8,15 @@ import { isString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/typ
|
|
|
8
8
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
9
9
|
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
|
-
import { BroadcastDataChannel } from '@codingame/monaco-vscode-
|
|
11
|
+
import { BroadcastDataChannel } from '@codingame/monaco-vscode-81f603ca-d6ea-5402-90dd-3014dffc63b4-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(1781, "File does not exist")), FileSystemProviderErrorCode.FileNotFound);
|
|
14
|
+
const ERR_FILE_IS_DIR = createFileSystemProviderError(( localize(1782, "File is Directory")), FileSystemProviderErrorCode.FileIsADirectory);
|
|
15
|
+
const ERR_FILE_NOT_DIR = createFileSystemProviderError(( localize(1783, "File is not a directory")), FileSystemProviderErrorCode.FileNotADirectory);
|
|
16
|
+
const ERR_DIR_NOT_EMPTY = createFileSystemProviderError(( localize(1784, "Directory is not empty")), FileSystemProviderErrorCode.Unknown);
|
|
17
|
+
const ERR_FILE_EXCEEDS_STORAGE_QUOTA = createFileSystemProviderError(( localize(1785, "File exceeds available storage quota")), FileSystemProviderErrorCode.FileExceedsStorageQuota);
|
|
18
18
|
const ERR_UNKNOWN_INTERNAL = (message) => createFileSystemProviderError(( localize(
|
|
19
|
-
|
|
19
|
+
1786,
|
|
20
20
|
"Internal error occurred in IndexedDB File System Provider. ({0})",
|
|
21
21
|
message
|
|
22
22
|
)), FileSystemProviderErrorCode.Unknown);
|
|
@@ -52,6 +52,7 @@ export declare class FileService extends Disposable implements IFileService {
|
|
|
52
52
|
private doValidateCreateFile;
|
|
53
53
|
createFile(resource: URI, bufferOrReadableOrStream?: VSBuffer | VSBufferReadable | VSBufferReadableStream, options?: ICreateFileOptions): Promise<IFileStatWithMetadata>;
|
|
54
54
|
writeFile(resource: URI, bufferOrReadableOrStream: VSBuffer | VSBufferReadable | VSBufferReadableStream, options?: IWriteFileOptions): Promise<IFileStatWithMetadata>;
|
|
55
|
+
private peekBufferForWriting;
|
|
55
56
|
private validateWriteFile;
|
|
56
57
|
readFile(resource: URI, options?: IReadFileOptions, token?: CancellationToken): Promise<IFileContent>;
|
|
57
58
|
private doReadFileAtomic;
|
|
@@ -88,7 +89,9 @@ export declare class FileService extends Disposable implements IFileService {
|
|
|
88
89
|
readonly onDidWatchError: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<Error>;
|
|
89
90
|
private readonly activeWatchers;
|
|
90
91
|
private static WATCHER_CORRELATION_IDS;
|
|
91
|
-
createWatcher(resource: URI, options: IWatchOptionsWithoutCorrelation
|
|
92
|
+
createWatcher(resource: URI, options: IWatchOptionsWithoutCorrelation & {
|
|
93
|
+
recursive: false;
|
|
94
|
+
}): IFileSystemWatcher;
|
|
92
95
|
watch(resource: URI, options: IWatchOptionsWithCorrelation): IFileSystemWatcher;
|
|
93
96
|
watch(resource: URI, options?: IWatchOptionsWithoutCorrelation): IDisposable;
|
|
94
97
|
private doWatch;
|
|
@@ -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
|
+
1787,
|
|
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
|
+
1788,
|
|
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
|
+
1789,
|
|
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
|
+
1790,
|
|
191
191
|
"Unable to resolve nonexistent file '{0}'",
|
|
192
192
|
this.resourceForError(resource)
|
|
193
193
|
)), FileOperationResult.FILE_NOT_FOUND));
|
|
@@ -298,7 +298,7 @@ let FileService = class FileService extends Disposable {
|
|
|
298
298
|
async doValidateCreateFile(resource, options) {
|
|
299
299
|
if (!options?.overwrite && (await this.exists(resource))) {
|
|
300
300
|
throw ( new FileOperationError(( localize(
|
|
301
|
-
|
|
301
|
+
1791,
|
|
302
302
|
"Unable to create file '{0}' that already exists when overwrite flag is not set",
|
|
303
303
|
this.resourceForError(resource)
|
|
304
304
|
)), FileOperationResult.FILE_MODIFIED_SINCE, options));
|
|
@@ -321,27 +321,12 @@ let FileService = class FileService extends Disposable {
|
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
try {
|
|
324
|
-
|
|
324
|
+
let { stat, buffer: bufferOrReadableOrStreamOrBufferedStream } = await this.validateWriteFile(provider, resource, bufferOrReadableOrStream, writeFileOptions);
|
|
325
325
|
if (!stat) {
|
|
326
326
|
await this.mkdirp(provider, providerExtUri.dirname(resource));
|
|
327
327
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
if (isReadableStream(bufferOrReadableOrStream)) {
|
|
331
|
-
const bufferedStream = await peekStream(bufferOrReadableOrStream, 3);
|
|
332
|
-
if (bufferedStream.ended) {
|
|
333
|
-
bufferOrReadableOrStreamOrBufferedStream = VSBuffer.concat(bufferedStream.buffer);
|
|
334
|
-
}
|
|
335
|
-
else {
|
|
336
|
-
bufferOrReadableOrStreamOrBufferedStream = bufferedStream;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
else {
|
|
340
|
-
bufferOrReadableOrStreamOrBufferedStream = peekReadable(bufferOrReadableOrStream, data => VSBuffer.concat(data), 3);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
else {
|
|
344
|
-
bufferOrReadableOrStreamOrBufferedStream = bufferOrReadableOrStream;
|
|
328
|
+
if (!bufferOrReadableOrStreamOrBufferedStream) {
|
|
329
|
+
bufferOrReadableOrStreamOrBufferedStream = await this.peekBufferForWriting(provider, bufferOrReadableOrStream);
|
|
345
330
|
}
|
|
346
331
|
if (!hasOpenReadWriteCloseCapability(provider) ||
|
|
347
332
|
(hasReadWriteCapability(provider) && bufferOrReadableOrStreamOrBufferedStream instanceof VSBuffer) ||
|
|
@@ -356,7 +341,7 @@ let FileService = class FileService extends Disposable {
|
|
|
356
341
|
}
|
|
357
342
|
catch (error) {
|
|
358
343
|
throw ( new FileOperationError(( localize(
|
|
359
|
-
|
|
344
|
+
1792,
|
|
360
345
|
"Unable to write file '{0}' ({1})",
|
|
361
346
|
this.resourceForError(resource),
|
|
362
347
|
(ensureFileSystemProviderError(error).toString())
|
|
@@ -364,11 +349,32 @@ let FileService = class FileService extends Disposable {
|
|
|
364
349
|
}
|
|
365
350
|
return this.resolve(resource, { resolveMetadata: true });
|
|
366
351
|
}
|
|
367
|
-
async
|
|
352
|
+
async peekBufferForWriting(provider, bufferOrReadableOrStream) {
|
|
353
|
+
let peekResult;
|
|
354
|
+
if (hasReadWriteCapability(provider) && !(bufferOrReadableOrStream instanceof VSBuffer)) {
|
|
355
|
+
if (isReadableStream(bufferOrReadableOrStream)) {
|
|
356
|
+
const bufferedStream = await peekStream(bufferOrReadableOrStream, 3);
|
|
357
|
+
if (bufferedStream.ended) {
|
|
358
|
+
peekResult = VSBuffer.concat(bufferedStream.buffer);
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
peekResult = bufferedStream;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
peekResult = peekReadable(bufferOrReadableOrStream, data => VSBuffer.concat(data), 3);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
peekResult = bufferOrReadableOrStream;
|
|
370
|
+
}
|
|
371
|
+
return peekResult;
|
|
372
|
+
}
|
|
373
|
+
async validateWriteFile(provider, resource, bufferOrReadableOrStream, options) {
|
|
368
374
|
const unlock = !!options?.unlock;
|
|
369
375
|
if (unlock && !(provider.capabilities & FileSystemProviderCapabilities.FileWriteUnlock)) {
|
|
370
376
|
throw ( new Error(( localize(
|
|
371
|
-
|
|
377
|
+
1793,
|
|
372
378
|
"Unable to unlock file '{0}' because provider does not support it.",
|
|
373
379
|
this.resourceForError(resource)
|
|
374
380
|
))));
|
|
@@ -377,21 +383,21 @@ let FileService = class FileService extends Disposable {
|
|
|
377
383
|
if (atomic) {
|
|
378
384
|
if (!(provider.capabilities & FileSystemProviderCapabilities.FileAtomicWrite)) {
|
|
379
385
|
throw ( new Error(( localize(
|
|
380
|
-
|
|
386
|
+
1794,
|
|
381
387
|
"Unable to atomically write file '{0}' because provider does not support it.",
|
|
382
388
|
this.resourceForError(resource)
|
|
383
389
|
))));
|
|
384
390
|
}
|
|
385
391
|
if (!(provider.capabilities & FileSystemProviderCapabilities.FileReadWrite)) {
|
|
386
392
|
throw ( new Error(( localize(
|
|
387
|
-
|
|
393
|
+
1795,
|
|
388
394
|
"Unable to atomically write file '{0}' because provider does not support unbuffered writes.",
|
|
389
395
|
this.resourceForError(resource)
|
|
390
396
|
))));
|
|
391
397
|
}
|
|
392
398
|
if (unlock) {
|
|
393
399
|
throw ( new Error(( localize(
|
|
394
|
-
|
|
400
|
+
1796,
|
|
395
401
|
"Unable to unlock file '{0}' because atomic write is enabled.",
|
|
396
402
|
this.resourceForError(resource)
|
|
397
403
|
))));
|
|
@@ -402,22 +408,34 @@ let FileService = class FileService extends Disposable {
|
|
|
402
408
|
stat = await provider.stat(resource);
|
|
403
409
|
}
|
|
404
410
|
catch (error) {
|
|
405
|
-
return
|
|
411
|
+
return Object.create(null);
|
|
406
412
|
}
|
|
407
413
|
if ((stat.type & FileType.Directory) !== 0) {
|
|
408
414
|
throw ( new FileOperationError(( localize(
|
|
409
|
-
|
|
415
|
+
1797,
|
|
410
416
|
"Unable to write file '{0}' that is actually a directory",
|
|
411
417
|
this.resourceForError(resource)
|
|
412
418
|
)), FileOperationResult.FILE_IS_DIRECTORY, options));
|
|
413
419
|
}
|
|
414
420
|
this.throwIfFileIsReadonly(resource, stat);
|
|
421
|
+
let buffer;
|
|
415
422
|
if (typeof options?.mtime === 'number' && typeof options.etag === 'string' && options.etag !== ETAG_DISABLED &&
|
|
416
423
|
typeof stat.mtime === 'number' && typeof stat.size === 'number' &&
|
|
417
424
|
options.mtime < stat.mtime && options.etag !== etag({ mtime: options.mtime , size: stat.size })) {
|
|
418
|
-
|
|
425
|
+
buffer = await this.peekBufferForWriting(provider, bufferOrReadableOrStream);
|
|
426
|
+
if (buffer instanceof VSBuffer && buffer.byteLength === stat.size) {
|
|
427
|
+
try {
|
|
428
|
+
const { value } = await this.readFile(resource, { limits: { size: stat.size } });
|
|
429
|
+
if (buffer.equals(value)) {
|
|
430
|
+
return { stat, buffer };
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
catch (error) {
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
throw ( new FileOperationError(( localize(1798, "File Modified Since")), FileOperationResult.FILE_MODIFIED_SINCE, options));
|
|
419
437
|
}
|
|
420
|
-
return stat;
|
|
438
|
+
return { stat, buffer };
|
|
421
439
|
}
|
|
422
440
|
async readFile(resource, options, token) {
|
|
423
441
|
const provider = await this.withReadProvider(resource);
|
|
@@ -497,7 +515,7 @@ let FileService = class FileService extends Disposable {
|
|
|
497
515
|
}
|
|
498
516
|
restoreReadError(error, resource, options) {
|
|
499
517
|
const message = ( localize(
|
|
500
|
-
|
|
518
|
+
1799,
|
|
501
519
|
"Unable to read file '{0}' ({1})",
|
|
502
520
|
this.resourceForError(resource),
|
|
503
521
|
(ensureFileSystemProviderError(error).toString())
|
|
@@ -557,13 +575,13 @@ let FileService = class FileService extends Disposable {
|
|
|
557
575
|
const stat = await this.resolve(resource, { resolveMetadata: true });
|
|
558
576
|
if (stat.isDirectory) {
|
|
559
577
|
throw ( new FileOperationError(( localize(
|
|
560
|
-
|
|
578
|
+
1800,
|
|
561
579
|
"Unable to read file '{0}' that is actually a directory",
|
|
562
580
|
this.resourceForError(resource)
|
|
563
581
|
)), FileOperationResult.FILE_IS_DIRECTORY, options));
|
|
564
582
|
}
|
|
565
583
|
if (typeof options?.etag === 'string' && options.etag !== ETAG_DISABLED && options.etag === stat.etag) {
|
|
566
|
-
throw ( new NotModifiedSinceFileOperationError(( localize(
|
|
584
|
+
throw ( new NotModifiedSinceFileOperationError(( localize(1801, "File not modified since")), stat, options));
|
|
567
585
|
}
|
|
568
586
|
this.validateReadFileLimits(resource, stat.size, options);
|
|
569
587
|
return stat;
|
|
@@ -571,7 +589,7 @@ let FileService = class FileService extends Disposable {
|
|
|
571
589
|
validateReadFileLimits(resource, size, options) {
|
|
572
590
|
if (typeof options?.limits?.size === 'number' && size > options.limits.size) {
|
|
573
591
|
throw ( new TooLargeFileOperationError(( localize(
|
|
574
|
-
|
|
592
|
+
1802,
|
|
575
593
|
"Unable to read file '{0}' that is too large to open",
|
|
576
594
|
this.resourceForError(resource)
|
|
577
595
|
)), FileOperationResult.FILE_TOO_LARGE, size, options));
|
|
@@ -693,7 +711,7 @@ let FileService = class FileService extends Disposable {
|
|
|
693
711
|
}
|
|
694
712
|
if (isSameResourceWithDifferentPathCase && mode === 'copy') {
|
|
695
713
|
throw ( new Error(( localize(
|
|
696
|
-
|
|
714
|
+
1803,
|
|
697
715
|
"Unable to copy when source '{0}' is same as target '{1}' with different path case on a case insensitive file system",
|
|
698
716
|
this.resourceForError(source),
|
|
699
717
|
this.resourceForError(target)
|
|
@@ -701,7 +719,7 @@ let FileService = class FileService extends Disposable {
|
|
|
701
719
|
}
|
|
702
720
|
if (!isSameResourceWithDifferentPathCase && providerExtUri.isEqualOrParent(target, source)) {
|
|
703
721
|
throw ( new Error(( localize(
|
|
704
|
-
|
|
722
|
+
1804,
|
|
705
723
|
"Unable to move/copy when source '{0}' is parent of target '{1}'.",
|
|
706
724
|
this.resourceForError(source),
|
|
707
725
|
this.resourceForError(target)
|
|
@@ -712,7 +730,7 @@ let FileService = class FileService extends Disposable {
|
|
|
712
730
|
if (exists && !isSameResourceWithDifferentPathCase) {
|
|
713
731
|
if (!overwrite) {
|
|
714
732
|
throw ( new FileOperationError(( localize(
|
|
715
|
-
|
|
733
|
+
1805,
|
|
716
734
|
"Unable to move/copy '{0}' because target '{1}' already exists at destination.",
|
|
717
735
|
this.resourceForError(source),
|
|
718
736
|
this.resourceForError(target)
|
|
@@ -722,7 +740,7 @@ let FileService = class FileService extends Disposable {
|
|
|
722
740
|
const { providerExtUri } = this.getExtUri(sourceProvider);
|
|
723
741
|
if (providerExtUri.isEqualOrParent(source, target)) {
|
|
724
742
|
throw ( new Error(( localize(
|
|
725
|
-
|
|
743
|
+
1806,
|
|
726
744
|
"Unable to move/copy '{0}' into '{1}' since a file would replace the folder it is contained in.",
|
|
727
745
|
this.resourceForError(source),
|
|
728
746
|
this.resourceForError(target)
|
|
@@ -767,7 +785,7 @@ let FileService = class FileService extends Disposable {
|
|
|
767
785
|
const useTrash = !!options?.useTrash;
|
|
768
786
|
if (useTrash && !(provider.capabilities & FileSystemProviderCapabilities.Trash)) {
|
|
769
787
|
throw ( new Error(( localize(
|
|
770
|
-
|
|
788
|
+
1807,
|
|
771
789
|
"Unable to delete file '{0}' via trash because provider does not support it.",
|
|
772
790
|
this.resourceForError(resource)
|
|
773
791
|
))));
|
|
@@ -775,14 +793,14 @@ let FileService = class FileService extends Disposable {
|
|
|
775
793
|
const atomic = options?.atomic;
|
|
776
794
|
if (atomic && !(provider.capabilities & FileSystemProviderCapabilities.FileAtomicDelete)) {
|
|
777
795
|
throw ( new Error(( localize(
|
|
778
|
-
|
|
796
|
+
1808,
|
|
779
797
|
"Unable to delete file '{0}' atomically because provider does not support it.",
|
|
780
798
|
this.resourceForError(resource)
|
|
781
799
|
))));
|
|
782
800
|
}
|
|
783
801
|
if (useTrash && atomic) {
|
|
784
802
|
throw ( new Error(( localize(
|
|
785
|
-
|
|
803
|
+
1809,
|
|
786
804
|
"Unable to atomically delete file '{0}' because using trash is enabled.",
|
|
787
805
|
this.resourceForError(resource)
|
|
788
806
|
))));
|
|
@@ -798,7 +816,7 @@ let FileService = class FileService extends Disposable {
|
|
|
798
816
|
}
|
|
799
817
|
else {
|
|
800
818
|
throw ( new FileOperationError(( localize(
|
|
801
|
-
|
|
819
|
+
1810,
|
|
802
820
|
"Unable to delete nonexistent file '{0}'",
|
|
803
821
|
this.resourceForError(resource)
|
|
804
822
|
)), FileOperationResult.FILE_NOT_FOUND));
|
|
@@ -808,7 +826,7 @@ let FileService = class FileService extends Disposable {
|
|
|
808
826
|
const stat = await this.resolve(resource);
|
|
809
827
|
if (stat.isDirectory && Array.isArray(stat.children) && stat.children.length > 0) {
|
|
810
828
|
throw ( new Error(( localize(
|
|
811
|
-
|
|
829
|
+
1811,
|
|
812
830
|
"Unable to delete non-empty folder '{0}'.",
|
|
813
831
|
this.resourceForError(resource)
|
|
814
832
|
))));
|
|
@@ -1067,7 +1085,7 @@ let FileService = class FileService extends Disposable {
|
|
|
1067
1085
|
throwIfFileSystemIsReadonly(provider, resource) {
|
|
1068
1086
|
if (provider.capabilities & FileSystemProviderCapabilities.Readonly) {
|
|
1069
1087
|
throw ( new FileOperationError(( localize(
|
|
1070
|
-
|
|
1088
|
+
1812,
|
|
1071
1089
|
"Unable to modify read-only file '{0}'",
|
|
1072
1090
|
this.resourceForError(resource)
|
|
1073
1091
|
)), FileOperationResult.FILE_PERMISSION_DENIED));
|
|
@@ -1077,7 +1095,7 @@ let FileService = class FileService extends Disposable {
|
|
|
1077
1095
|
throwIfFileIsReadonly(resource, stat) {
|
|
1078
1096
|
if ((stat.permissions ?? 0) & FilePermission.Readonly) {
|
|
1079
1097
|
throw ( new FileOperationError(( localize(
|
|
1080
|
-
|
|
1098
|
+
1812,
|
|
1081
1099
|
"Unable to modify read-only file '{0}'",
|
|
1082
1100
|
this.resourceForError(resource)
|
|
1083
1101
|
)), 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(1819, "File is too large to open")), FileSystemProviderErrorCode.FileTooLarge);
|
|
74
74
|
}
|
|
75
75
|
return true;
|
|
76
76
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AbstractTextFileService } from "./textFileService.js";
|
|
2
2
|
import { IWorkbenchEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service";
|
|
3
|
-
import { ICodeEditorService } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService";
|
|
4
|
-
import { IModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model";
|
|
5
|
-
import { ILanguageService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language";
|
|
6
|
-
import { ITextResourceConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration";
|
|
3
|
+
import { ICodeEditorService } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service";
|
|
4
|
+
import { IModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service";
|
|
5
|
+
import { ILanguageService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service";
|
|
6
|
+
import { ITextResourceConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration.service";
|
|
7
7
|
import { IFileDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
8
8
|
import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
9
9
|
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { AbstractTextFileService } from './textFileService.js';
|
|
4
|
-
import { TextFileEditorModelState } from '@codingame/monaco-vscode-
|
|
4
|
+
import { TextFileEditorModelState } from '@codingame/monaco-vscode-aff8bc9b-c6f8-578f-9c8a-f70d14f9c13c-common/vscode/vs/workbench/services/textfile/common/textfiles';
|
|
5
5
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
6
6
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/extensions';
|
|
7
7
|
import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
8
|
-
import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService';
|
|
9
|
-
import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model';
|
|
10
|
-
import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language';
|
|
11
|
-
import { ITextResourceConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration';
|
|
8
|
+
import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service';
|
|
9
|
+
import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service';
|
|
10
|
+
import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service';
|
|
11
|
+
import { ITextResourceConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration.service';
|
|
12
12
|
import { IDialogService, IFileDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
13
13
|
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
14
14
|
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
2
|
-
import { ITextFileStreamContent, ITextFileContent, IResourceEncodings, IReadTextFileOptions, IWriteTextFileOptions, ITextFileSaveOptions, ITextFileEditorModelManager, IResourceEncoding, ITextFileSaveAsOptions, IReadTextFileEncodingOptions } from "@codingame/monaco-vscode-
|
|
2
|
+
import { ITextFileStreamContent, ITextFileContent, IResourceEncodings, IReadTextFileOptions, IWriteTextFileOptions, ITextFileSaveOptions, ITextFileEditorModelManager, IResourceEncoding, ITextFileSaveAsOptions, IReadTextFileEncodingOptions } from "@codingame/monaco-vscode-aff8bc9b-c6f8-578f-9c8a-f70d14f9c13c-common/vscode/vs/workbench/services/textfile/common/textfiles";
|
|
3
3
|
import { ITextFileService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/textfile/common/textfiles.service";
|
|
4
4
|
import { IRevertOptions } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor";
|
|
5
5
|
import { ILifecycleService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service";
|
|
@@ -9,21 +9,21 @@ import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/l
|
|
|
9
9
|
import { IWorkbenchEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service";
|
|
10
10
|
import { IUntitledTextEditorModelManager } from "@codingame/monaco-vscode-view-common-service-override/vscode/vs/workbench/services/untitled/common/untitledTextEditorService";
|
|
11
11
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
12
|
-
import { IModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model";
|
|
12
|
+
import { IModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service";
|
|
13
13
|
import { IFileDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
14
14
|
import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
15
15
|
import { VSBuffer, VSBufferReadable, VSBufferReadableStream } from "@codingame/monaco-vscode-api/vscode/vs/base/common/buffer";
|
|
16
16
|
import { ITextSnapshot } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/model";
|
|
17
|
-
import { ITextResourceConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration";
|
|
17
|
+
import { ITextResourceConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration.service";
|
|
18
18
|
import { IFilesConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service";
|
|
19
|
-
import { ICodeEditorService } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService";
|
|
19
|
+
import { ICodeEditorService } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service";
|
|
20
20
|
import { IPathService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service";
|
|
21
21
|
import { IFileOperationUndoRedoInfo } from "@codingame/monaco-vscode-base-service-override/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService";
|
|
22
22
|
import { IWorkingCopyFileService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service";
|
|
23
23
|
import { IUriIdentityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
|
|
24
24
|
import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
|
|
25
25
|
import { ReadableStream } from "@codingame/monaco-vscode-api/vscode/vs/base/common/stream";
|
|
26
|
-
import { ILanguageService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language";
|
|
26
|
+
import { ILanguageService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service";
|
|
27
27
|
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
28
28
|
import { IElevatedFileService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/files/common/elevatedFileService.service";
|
|
29
29
|
import { IDecorationsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/decorations/common/decorations.service";
|
|
@@ -64,13 +64,14 @@ export declare abstract class AbstractTextFileService extends Disposable impleme
|
|
|
64
64
|
options?: ICreateFileOptions;
|
|
65
65
|
}[], undoInfo?: IFileOperationUndoRedoInfo): Promise<readonly IFileStatWithMetadata[]>;
|
|
66
66
|
write(resource: URI, value: string | ITextSnapshot, options?: IWriteTextFileOptions): Promise<IFileStatWithMetadata>;
|
|
67
|
-
|
|
68
|
-
getEncodedReadable(resource: URI, value:
|
|
69
|
-
getEncodedReadable(resource: URI, value
|
|
70
|
-
getEncodedReadable(resource: URI, value?:
|
|
71
|
-
getEncodedReadable(resource: URI, value?: string
|
|
72
|
-
getEncodedReadable(resource: URI, value
|
|
73
|
-
|
|
67
|
+
getEncoding(resource: URI): string;
|
|
68
|
+
getEncodedReadable(resource: URI | undefined, value: ITextSnapshot): Promise<VSBufferReadable>;
|
|
69
|
+
getEncodedReadable(resource: URI | undefined, value: string): Promise<VSBuffer | VSBufferReadable>;
|
|
70
|
+
getEncodedReadable(resource: URI | undefined, value?: ITextSnapshot): Promise<VSBufferReadable | undefined>;
|
|
71
|
+
getEncodedReadable(resource: URI | undefined, value?: string): Promise<VSBuffer | VSBufferReadable | undefined>;
|
|
72
|
+
getEncodedReadable(resource: URI | undefined, value?: string | ITextSnapshot): Promise<VSBuffer | VSBufferReadable | undefined>;
|
|
73
|
+
getEncodedReadable(resource: URI | undefined, value: string | ITextSnapshot, options?: IWriteTextFileOptions): Promise<VSBuffer | VSBufferReadable>;
|
|
74
|
+
getDecodedStream(resource: URI | undefined, value: VSBufferReadableStream, options?: IReadTextFileEncodingOptions): Promise<ReadableStream<string>>;
|
|
74
75
|
private doGetDecodedStream;
|
|
75
76
|
save(resource: URI, options?: ITextFileSaveOptions): Promise<URI | undefined>;
|
|
76
77
|
saveAs(source: URI, target?: URI, options?: ITextFileSaveAsOptions): Promise<URI | undefined>;
|
|
@@ -99,12 +100,13 @@ export declare class EncodingOracle extends Disposable implements IResourceEncod
|
|
|
99
100
|
constructor(textResourceConfigurationService: ITextResourceConfigurationService, environmentService: IWorkbenchEnvironmentService, contextService: IWorkspaceContextService, uriIdentityService: IUriIdentityService);
|
|
100
101
|
private registerListeners;
|
|
101
102
|
private getDefaultEncodingOverrides;
|
|
102
|
-
getWriteEncoding(resource: URI, options?: IWriteTextFileOptions): Promise<{
|
|
103
|
+
getWriteEncoding(resource: URI | undefined, options?: IWriteTextFileOptions): Promise<{
|
|
103
104
|
encoding: string;
|
|
104
105
|
addBOM: boolean;
|
|
105
106
|
}>;
|
|
106
|
-
getPreferredWriteEncoding(resource: URI, preferredEncoding?: string): Promise<IResourceEncoding>;
|
|
107
|
-
getPreferredReadEncoding(resource: URI, options?: IReadTextFileEncodingOptions, detectedEncoding?: string): Promise<IResourceEncoding>;
|
|
108
|
-
|
|
107
|
+
getPreferredWriteEncoding(resource: URI | undefined, preferredEncoding?: string): Promise<IResourceEncoding>;
|
|
108
|
+
getPreferredReadEncoding(resource: URI | undefined, options?: IReadTextFileEncodingOptions, detectedEncoding?: string): Promise<IResourceEncoding>;
|
|
109
|
+
getUnvalidatedEncodingForResource(resource: URI | undefined, preferredEncoding?: string): string;
|
|
110
|
+
private getValidatedEncodingForResource;
|
|
109
111
|
private getEncodingOverride;
|
|
110
112
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
4
|
-
import { TextFileEditorModelState, TextFileOperationError, TextFileOperationResult, toBufferOrReadable, stringToSnapshot } from '@codingame/monaco-vscode-
|
|
4
|
+
import { TextFileEditorModelState, TextFileOperationError, TextFileOperationResult, toBufferOrReadable, stringToSnapshot } from '@codingame/monaco-vscode-aff8bc9b-c6f8-578f-9c8a-f70d14f9c13c-common/vscode/vs/workbench/services/textfile/common/textfiles';
|
|
5
5
|
import { SaveSourceRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
6
6
|
import { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
7
7
|
import { FileOperationResult } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
|
|
@@ -15,15 +15,15 @@ import { TextFileEditorModelManager } from '../common/textFileEditorModelManager
|
|
|
15
15
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
16
16
|
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
17
17
|
import { createTextBufferFactoryFromStream, createTextBufferFactoryFromSnapshot } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model/textModel';
|
|
18
|
-
import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model';
|
|
18
|
+
import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service';
|
|
19
19
|
import { isEqual, toLocalResource, basename, dirname, joinPath, extname as extname$1 } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
20
20
|
import { IDialogService, IFileDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
21
21
|
import { bufferToStream } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
22
|
-
import { ITextResourceConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration';
|
|
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-
|
|
26
|
-
import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService';
|
|
25
|
+
import { BaseTextEditorModel } from '@codingame/monaco-vscode-aff8bc9b-c6f8-578f-9c8a-f70d14f9c13c-common/vscode/vs/workbench/common/editor/textEditorModel';
|
|
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';
|
|
29
29
|
import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
@@ -31,7 +31,7 @@ import { WORKSPACE_EXTENSION } from '@codingame/monaco-vscode-api/vscode/vs/plat
|
|
|
31
31
|
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
32
32
|
import { UTF8, DecodeStreamErrorKind, toEncodeReadable, toDecodeStream, UTF16be, UTF16le, UTF8_with_bom, encodingExists } from '@codingame/monaco-vscode-2e67e044-0db9-5fa6-8bd1-3737a7d586d4-common/vscode/vs/workbench/services/textfile/common/encoding';
|
|
33
33
|
import { consumeStream } from '@codingame/monaco-vscode-api/vscode/vs/base/common/stream';
|
|
34
|
-
import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language';
|
|
34
|
+
import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service';
|
|
35
35
|
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
36
36
|
import { CancellationTokenSource, CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
37
37
|
import { IElevatedFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/files/common/elevatedFileService.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(12110, "File Created"))); }
|
|
57
|
+
static { this.TEXTFILE_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource('textFileOverwrite.source', ( localize(12111, "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;
|
|
@@ -84,7 +84,7 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
84
84
|
constructor(files) {
|
|
85
85
|
super();
|
|
86
86
|
this.files = files;
|
|
87
|
-
this.label = ( localize(
|
|
87
|
+
this.label = ( localize(12112, "Text File Model Decorations"));
|
|
88
88
|
this._onDidChange = this._register(( new Emitter()));
|
|
89
89
|
this.onDidChange = this._onDidChange.event;
|
|
90
90
|
this.registerListeners();
|
|
@@ -111,20 +111,20 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
111
111
|
color: listErrorForeground,
|
|
112
112
|
letter: Codicon.lockSmall,
|
|
113
113
|
strikethrough: true,
|
|
114
|
-
tooltip: ( localize(
|
|
114
|
+
tooltip: ( localize(12113, "Deleted, Read-only")),
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
117
|
else if (isReadonly) {
|
|
118
118
|
return {
|
|
119
119
|
letter: Codicon.lockSmall,
|
|
120
|
-
tooltip: ( localize(
|
|
120
|
+
tooltip: ( localize(12114, "Read-only")),
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
else if (isOrphaned) {
|
|
124
124
|
return {
|
|
125
125
|
color: listErrorForeground,
|
|
126
126
|
strikethrough: true,
|
|
127
|
-
tooltip: ( localize(
|
|
127
|
+
tooltip: ( localize(12115, "Deleted")),
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
130
|
return undefined;
|
|
@@ -177,7 +177,7 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
177
177
|
catch (error) {
|
|
178
178
|
cts.dispose(true);
|
|
179
179
|
if (error.decodeStreamErrorKind === DecodeStreamErrorKind.STREAM_IS_BINARY) {
|
|
180
|
-
throw ( new TextFileOperationError(( localize(
|
|
180
|
+
throw ( new TextFileOperationError(( localize(12116, "File seems to be binary and cannot be opened as text")), TextFileOperationResult.FILE_IS_BINARY, options));
|
|
181
181
|
}
|
|
182
182
|
else {
|
|
183
183
|
throw error;
|
|
@@ -202,6 +202,10 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
202
202
|
}
|
|
203
203
|
return this.fileService.writeFile(resource, readable, options);
|
|
204
204
|
}
|
|
205
|
+
getEncoding(resource) {
|
|
206
|
+
const model = resource.scheme === Schemas.untitled ? this.untitled.get(resource) : this.files.get(resource);
|
|
207
|
+
return model?.getEncoding() ?? this.encoding.getUnvalidatedEncodingForResource(resource);
|
|
208
|
+
}
|
|
205
209
|
async getEncodedReadable(resource, value, options) {
|
|
206
210
|
const { encoding, addBOM } = await this.encoding.getWriteEncoding(resource, options);
|
|
207
211
|
if (encoding === UTF8 && !addBOM) {
|
|
@@ -395,17 +399,17 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
395
399
|
const { confirmed } = await this.dialogService.confirm({
|
|
396
400
|
type: 'warning',
|
|
397
401
|
message: ( localize(
|
|
398
|
-
|
|
402
|
+
12117,
|
|
399
403
|
"'{0}' already exists. Do you want to replace it?",
|
|
400
404
|
basename(resource)
|
|
401
405
|
)),
|
|
402
406
|
detail: ( localize(
|
|
403
|
-
|
|
407
|
+
12118,
|
|
404
408
|
"A file or folder with the name '{0}' already exists in the folder '{1}'. Replacing it will overwrite its current contents.",
|
|
405
409
|
basename(resource),
|
|
406
410
|
basename(dirname(resource))
|
|
407
411
|
)),
|
|
408
|
-
primaryButton: ( localize(
|
|
412
|
+
primaryButton: ( localize(12119, "&&Replace")),
|
|
409
413
|
});
|
|
410
414
|
return confirmed;
|
|
411
415
|
}
|
|
@@ -413,12 +417,12 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
413
417
|
const { confirmed } = await this.dialogService.confirm({
|
|
414
418
|
type: 'warning',
|
|
415
419
|
message: ( localize(
|
|
416
|
-
|
|
420
|
+
12120,
|
|
417
421
|
"'{0}' is marked as read-only. Do you want to save anyway?",
|
|
418
422
|
basename(resource)
|
|
419
423
|
)),
|
|
420
|
-
detail: ( localize(
|
|
421
|
-
primaryButton: ( localize(
|
|
424
|
+
detail: ( localize(12121, "Paths can be configured as read-only via settings.")),
|
|
425
|
+
primaryButton: ( localize(12122, "&&Save Anyway"))
|
|
422
426
|
});
|
|
423
427
|
return confirmed;
|
|
424
428
|
}
|
|
@@ -551,7 +555,7 @@ let EncodingOracle = class EncodingOracle extends Disposable {
|
|
|
551
555
|
return { encoding, addBOM: hasBOM };
|
|
552
556
|
}
|
|
553
557
|
async getPreferredWriteEncoding(resource, preferredEncoding) {
|
|
554
|
-
const resourceEncoding = await this.
|
|
558
|
+
const resourceEncoding = await this.getValidatedEncodingForResource(resource, preferredEncoding);
|
|
555
559
|
return {
|
|
556
560
|
encoding: resourceEncoding,
|
|
557
561
|
hasBOM: resourceEncoding === UTF16be || resourceEncoding === UTF16le || resourceEncoding === UTF8_with_bom
|
|
@@ -573,13 +577,13 @@ let EncodingOracle = class EncodingOracle extends Disposable {
|
|
|
573
577
|
else if (this.textResourceConfigurationService.getValue(resource, 'files.encoding') === UTF8_with_bom) {
|
|
574
578
|
preferredEncoding = UTF8;
|
|
575
579
|
}
|
|
576
|
-
const encoding = await this.
|
|
580
|
+
const encoding = await this.getValidatedEncodingForResource(resource, preferredEncoding);
|
|
577
581
|
return {
|
|
578
582
|
encoding,
|
|
579
583
|
hasBOM: encoding === UTF16be || encoding === UTF16le || encoding === UTF8_with_bom
|
|
580
584
|
};
|
|
581
585
|
}
|
|
582
|
-
|
|
586
|
+
getUnvalidatedEncodingForResource(resource, preferredEncoding) {
|
|
583
587
|
let fileEncoding;
|
|
584
588
|
const override = this.getEncodingOverride(resource);
|
|
585
589
|
if (override) {
|
|
@@ -591,15 +595,17 @@ let EncodingOracle = class EncodingOracle extends Disposable {
|
|
|
591
595
|
else {
|
|
592
596
|
fileEncoding = this.textResourceConfigurationService.getValue(resource, 'files.encoding');
|
|
593
597
|
}
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
+
return fileEncoding || UTF8;
|
|
599
|
+
}
|
|
600
|
+
async getValidatedEncodingForResource(resource, preferredEncoding) {
|
|
601
|
+
let fileEncoding = this.getUnvalidatedEncodingForResource(resource, preferredEncoding);
|
|
602
|
+
if (fileEncoding !== UTF8 && !(await encodingExists(fileEncoding))) {
|
|
603
|
+
fileEncoding = UTF8;
|
|
598
604
|
}
|
|
599
605
|
return fileEncoding;
|
|
600
606
|
}
|
|
601
607
|
getEncodingOverride(resource) {
|
|
602
|
-
if (this.encodingOverrides?.length) {
|
|
608
|
+
if (resource && this.encodingOverrides?.length) {
|
|
603
609
|
for (const override of this.encodingOverrides) {
|
|
604
610
|
if (override.parent && this.uriIdentityService.extUri.isEqualOrParent(resource, override.parent)) {
|
|
605
611
|
return override.encoding;
|
|
@@ -2,7 +2,7 @@ import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event"
|
|
|
2
2
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
3
3
|
import { TextFileEditorModel } from "@codingame/monaco-vscode-0c06bfba-d24d-5c4d-90cd-b40cefb7f811-common/vscode/vs/workbench/services/textfile/common/textFileEditorModel";
|
|
4
4
|
import { IDisposable, Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
5
|
-
import { ITextFileEditorModel, ITextFileEditorModelManager, ITextFileEditorModelResolveOrCreateOptions, ITextFileResolveEvent, ITextFileSaveEvent, ITextFileSaveParticipant } from "@codingame/monaco-vscode-
|
|
5
|
+
import { ITextFileEditorModel, ITextFileEditorModelManager, ITextFileEditorModelResolveOrCreateOptions, ITextFileResolveEvent, ITextFileSaveEvent, ITextFileSaveParticipant } from "@codingame/monaco-vscode-aff8bc9b-c6f8-578f-9c8a-f70d14f9c13c-common/vscode/vs/workbench/services/textfile/common/textfiles";
|
|
6
6
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
7
7
|
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
8
8
|
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
@@ -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
|
+
12126,
|
|
67
67
|
"Failed to save '{0}': {1}",
|
|
68
68
|
model.name,
|
|
69
69
|
toErrorMessage(error, false)
|
|
@@ -2,7 +2,7 @@ import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/c
|
|
|
2
2
|
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
3
3
|
import { IProgress, IProgressStep } from "@codingame/monaco-vscode-api/vscode/vs/platform/progress/common/progress";
|
|
4
4
|
import { IProgressService } from "@codingame/monaco-vscode-api/vscode/vs/platform/progress/common/progress.service";
|
|
5
|
-
import { ITextFileSaveParticipant, ITextFileEditorModel, ITextFileSaveParticipantContext } from "@codingame/monaco-vscode-
|
|
5
|
+
import { ITextFileSaveParticipant, ITextFileEditorModel, ITextFileSaveParticipantContext } from "@codingame/monaco-vscode-aff8bc9b-c6f8-578f-9c8a-f70d14f9c13c-common/vscode/vs/workbench/services/textfile/common/textfiles";
|
|
6
6
|
import { IDisposable, Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
7
7
|
export declare class TextFileSaveParticipant extends Disposable {
|
|
8
8
|
private readonly logService;
|
|
@@ -26,16 +26,21 @@ 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(12127, "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(12128, "Skip")),
|
|
36
36
|
delay: model.isDirty() ? 5000 : 3000
|
|
37
37
|
}, async (progress) => {
|
|
38
|
-
|
|
38
|
+
const participants = Array.from(this.saveParticipants).sort((a, b) => {
|
|
39
|
+
const aValue = a.ordinal ?? 0;
|
|
40
|
+
const bValue = b.ordinal ?? 0;
|
|
41
|
+
return aValue - bValue;
|
|
42
|
+
});
|
|
43
|
+
for (const saveParticipant of participants) {
|
|
39
44
|
if (cts.token.isCancellationRequested || !model.textEditorModel ) {
|
|
40
45
|
break;
|
|
41
46
|
}
|