@codingame/monaco-vscode-files-service-override 26.1.2 → 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/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",
|