@codingame/monaco-vscode-files-service-override 26.1.1 → 26.2.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 +3 -3
- package/index.js +25 -10
- package/package.json +2 -2
- package/vscode/src/vs/workbench/services/textfile/browser/textFileService.js +13 -13
- 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
|
@@ -146,7 +146,7 @@ declare class OverlayFileSystemProvider implements IFileSystemProviderWithFileRe
|
|
|
146
146
|
delete(resource: URI, opts: IFileDeleteOptions): Promise<void>;
|
|
147
147
|
rename(from: URI, to: URI, opts: IFileOverwriteOptions): Promise<void>;
|
|
148
148
|
}
|
|
149
|
-
declare class DelegateFileSystemProvider implements
|
|
149
|
+
declare class DelegateFileSystemProvider implements IFileSystemProviderWithFileReadWriteCapability {
|
|
150
150
|
private options;
|
|
151
151
|
constructor(options: {
|
|
152
152
|
delegate: IFileSystemProvider;
|
|
@@ -159,8 +159,8 @@ declare class DelegateFileSystemProvider implements IFileSystemProvider {
|
|
|
159
159
|
type: FileChangeType;
|
|
160
160
|
resource: URI;
|
|
161
161
|
}[]>;
|
|
162
|
-
readFile: (
|
|
163
|
-
writeFile: (
|
|
162
|
+
readFile: (resource: URI) => Promise<Uint8Array>;
|
|
163
|
+
writeFile: (resource: URI, content: Uint8Array, opts: IFileWriteOptions) => Promise<void>;
|
|
164
164
|
watch(resource: URI, opts: IWatchOptions): IDisposable;
|
|
165
165
|
stat(resource: URI): Promise<IStat>;
|
|
166
166
|
mkdir(resource: URI): Promise<void>;
|
package/index.js
CHANGED
|
@@ -474,7 +474,8 @@ class OverlayFileSystemProvider {
|
|
|
474
474
|
this.onDidChangeOverlays = this._onDidChangeOverlays.event;
|
|
475
475
|
this.capabilities = FileSystemProviderCapabilities.FileReadWrite |
|
|
476
476
|
FileSystemProviderCapabilities.PathCaseSensitive |
|
|
477
|
-
FileSystemProviderCapabilities.FileReadStream
|
|
477
|
+
FileSystemProviderCapabilities.FileReadStream |
|
|
478
|
+
FileSystemProviderCapabilities.FileAppend;
|
|
478
479
|
}
|
|
479
480
|
register(priority, provider) {
|
|
480
481
|
const item = { priority, provider };
|
|
@@ -503,7 +504,7 @@ class OverlayFileSystemProvider {
|
|
|
503
504
|
if (this.delegates.length === 0) {
|
|
504
505
|
throw createFileSystemProviderError('No delegate', FileSystemProviderErrorCode.Unavailable);
|
|
505
506
|
}
|
|
506
|
-
|
|
507
|
+
const errors = [];
|
|
507
508
|
for (const delegate of this.delegates) {
|
|
508
509
|
if (token != null && token.isCancellationRequested) {
|
|
509
510
|
throw new Error('Cancelled');
|
|
@@ -512,19 +513,24 @@ class OverlayFileSystemProvider {
|
|
|
512
513
|
return await caller(delegate);
|
|
513
514
|
}
|
|
514
515
|
catch (err) {
|
|
515
|
-
|
|
516
|
-
if (err instanceof FileSystemProviderError
|
|
517
|
-
[
|
|
516
|
+
errors.push(err);
|
|
517
|
+
if (err instanceof FileSystemProviderError) {
|
|
518
|
+
if ([
|
|
518
519
|
FileSystemProviderErrorCode.NoPermissions,
|
|
519
520
|
FileSystemProviderErrorCode.FileNotFound,
|
|
520
521
|
FileSystemProviderErrorCode.Unavailable
|
|
521
522
|
].includes(err.code)) {
|
|
522
|
-
|
|
523
|
+
continue;
|
|
524
|
+
}
|
|
523
525
|
}
|
|
524
526
|
throw err;
|
|
525
527
|
}
|
|
526
528
|
}
|
|
527
|
-
|
|
529
|
+
const fileSystemErrors = errors?.filter((err) => err instanceof FileSystemProviderError);
|
|
530
|
+
const mostRelevantErrors = fileSystemErrors.find((err) => err.code === FileSystemProviderErrorCode.FileNotFound) ??
|
|
531
|
+
fileSystemErrors[0] ??
|
|
532
|
+
errors[0];
|
|
533
|
+
throw mostRelevantErrors;
|
|
528
534
|
}
|
|
529
535
|
async writeToDelegates(resource, caller) {
|
|
530
536
|
if (this.delegates.length === 0) {
|
|
@@ -661,18 +667,27 @@ class DelegateFileSystemProvider {
|
|
|
661
667
|
? (resource) => {
|
|
662
668
|
return this.options.delegate.readFile(this.options.toDelegate(resource));
|
|
663
669
|
}
|
|
664
|
-
:
|
|
670
|
+
: () => {
|
|
671
|
+
throw createFileSystemProviderError('No delegate', FileSystemProviderErrorCode.Unavailable);
|
|
672
|
+
};
|
|
665
673
|
this.writeFile = this.options.delegate.writeFile != null
|
|
666
674
|
? (resource, content, opts) => {
|
|
667
675
|
return this.options.delegate.writeFile(this.options.toDelegate(resource), content, opts);
|
|
668
676
|
}
|
|
669
|
-
:
|
|
677
|
+
: () => {
|
|
678
|
+
throw createFileSystemProviderError('No delegate', FileSystemProviderErrorCode.Unavailable);
|
|
679
|
+
};
|
|
670
680
|
}
|
|
671
681
|
get capabilities() {
|
|
672
682
|
return this.options.delegate.capabilities;
|
|
673
683
|
}
|
|
674
684
|
watch(resource, opts) {
|
|
675
|
-
|
|
685
|
+
try {
|
|
686
|
+
return this.options.delegate.watch(this.options.toDelegate(resource), opts);
|
|
687
|
+
}
|
|
688
|
+
catch {
|
|
689
|
+
}
|
|
690
|
+
return Disposable.None;
|
|
676
691
|
}
|
|
677
692
|
stat(resource) {
|
|
678
693
|
return this.options.delegate.stat(this.options.toDelegate(resource));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-files-service-override",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - files service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "26.
|
|
18
|
+
"@codingame/monaco-vscode-api": "26.2.0"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"module": "index.js",
|
|
@@ -56,10 +56,10 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
56
56
|
AbstractTextFileService_1 = this;
|
|
57
57
|
}
|
|
58
58
|
static {
|
|
59
|
-
this.TEXTFILE_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource("textFileCreate.source", ( localize(
|
|
59
|
+
this.TEXTFILE_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource("textFileCreate.source", ( localize(14880, "File Created")));
|
|
60
60
|
}
|
|
61
61
|
static {
|
|
62
|
-
this.TEXTFILE_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource("textFileOverwrite.source", ( localize(
|
|
62
|
+
this.TEXTFILE_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource("textFileOverwrite.source", ( localize(14881, "File Replaced")));
|
|
63
63
|
}
|
|
64
64
|
constructor(
|
|
65
65
|
fileService,
|
|
@@ -108,7 +108,7 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
108
108
|
constructor(files) {
|
|
109
109
|
super();
|
|
110
110
|
this.files = files;
|
|
111
|
-
this.label = ( localize(
|
|
111
|
+
this.label = ( localize(14882, "Text File Model Decorations"));
|
|
112
112
|
this._onDidChange = this._register(( new Emitter()));
|
|
113
113
|
this.onDidChange = this._onDidChange.event;
|
|
114
114
|
this.registerListeners();
|
|
@@ -143,20 +143,20 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
143
143
|
color: listErrorForeground,
|
|
144
144
|
letter: Codicon.lockSmall,
|
|
145
145
|
strikethrough: true,
|
|
146
|
-
tooltip: ( localize(
|
|
146
|
+
tooltip: ( localize(14883, "Deleted, Read-only"))
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
149
|
else if (isReadonly) {
|
|
150
150
|
return {
|
|
151
151
|
letter: Codicon.lockSmall,
|
|
152
|
-
tooltip: ( localize(
|
|
152
|
+
tooltip: ( localize(14884, "Read-only"))
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
155
|
else if (isOrphaned) {
|
|
156
156
|
return {
|
|
157
157
|
color: listErrorForeground,
|
|
158
158
|
strikethrough: true,
|
|
159
|
-
tooltip: ( localize(
|
|
159
|
+
tooltip: ( localize(14885, "Deleted"))
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
162
|
return undefined;
|
|
@@ -207,7 +207,7 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
207
207
|
} catch (error) {
|
|
208
208
|
cts.dispose(true);
|
|
209
209
|
if (error.decodeStreamErrorKind === DecodeStreamErrorKind.STREAM_IS_BINARY) {
|
|
210
|
-
throw ( new TextFileOperationError(( localize(
|
|
210
|
+
throw ( new TextFileOperationError(( localize(14886, "File seems to be binary and cannot be opened as text")), TextFileOperationResult.FILE_IS_BINARY, options));
|
|
211
211
|
}
|
|
212
212
|
else {
|
|
213
213
|
throw error;
|
|
@@ -481,17 +481,17 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
481
481
|
} = await this.dialogService.confirm({
|
|
482
482
|
type: "warning",
|
|
483
483
|
message: ( localize(
|
|
484
|
-
|
|
484
|
+
14887,
|
|
485
485
|
"'{0}' already exists. Do you want to replace it?",
|
|
486
486
|
basename(resource)
|
|
487
487
|
)),
|
|
488
488
|
detail: ( localize(
|
|
489
|
-
|
|
489
|
+
14888,
|
|
490
490
|
"A file or folder with the name '{0}' already exists in the folder '{1}'. Replacing it will overwrite its current contents.",
|
|
491
491
|
basename(resource),
|
|
492
492
|
basename(dirname(resource))
|
|
493
493
|
)),
|
|
494
|
-
primaryButton: ( localize(
|
|
494
|
+
primaryButton: ( localize(14889, "&&Replace"))
|
|
495
495
|
});
|
|
496
496
|
return confirmed;
|
|
497
497
|
}
|
|
@@ -501,12 +501,12 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
501
501
|
} = await this.dialogService.confirm({
|
|
502
502
|
type: "warning",
|
|
503
503
|
message: ( localize(
|
|
504
|
-
|
|
504
|
+
14890,
|
|
505
505
|
"'{0}' is marked as read-only. Do you want to save anyway?",
|
|
506
506
|
basename(resource)
|
|
507
507
|
)),
|
|
508
|
-
detail: ( localize(
|
|
509
|
-
primaryButton: ( localize(
|
|
508
|
+
detail: ( localize(14891, "Paths can be configured as read-only via settings.")),
|
|
509
|
+
primaryButton: ( localize(14892, "&&Save Anyway"))
|
|
510
510
|
});
|
|
511
511
|
return confirmed;
|
|
512
512
|
}
|
|
@@ -69,7 +69,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
69
69
|
return {
|
|
70
70
|
onSaveError(error, model) {
|
|
71
71
|
notificationService.error(( localize(
|
|
72
|
-
|
|
72
|
+
14896,
|
|
73
73
|
"Failed to save '{0}': {1}",
|
|
74
74
|
model.name,
|
|
75
75
|
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(14897, "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(14898, "Skip")),
|
|
36
36
|
delay: model.isDirty() ? 5000 : 3000
|
|
37
37
|
}, async progress => {
|
|
38
38
|
const participants = Array.from(this.saveParticipants).sort((a, b) => {
|