@codingame/monaco-vscode-files-service-override 11.1.2 → 12.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 +230 -2
- package/index.js +860 -4
- package/package.json +31 -7
- package/vscode/src/vs/platform/files/browser/indexedDBFileSystemProvider.d.ts +68 -0
- package/vscode/src/vs/platform/files/browser/indexedDBFileSystemProvider.js +43 -44
- package/vscode/src/vs/platform/files/common/fileService.d.ts +113 -0
- package/vscode/src/vs/platform/files/common/fileService.js +157 -176
- package/vscode/src/vs/platform/files/common/io.d.ts +10 -0
- package/vscode/src/vs/platform/files/common/io.js +2 -1
- package/vscode/src/vs/workbench/services/files/browser/elevatedFileService.d.ts +9 -0
- package/vscode/src/vs/workbench/services/files/browser/elevatedFileService.js +2 -0
- package/vscode/src/vs/workbench/services/textfile/browser/browserTextFileService.d.ts +24 -0
- package/vscode/src/vs/workbench/services/textfile/browser/browserTextFileService.js +5 -2
- package/vscode/src/vs/workbench/services/textfile/browser/textFileService.d.ts +111 -0
- package/vscode/src/vs/workbench/services/textfile/browser/textFileService.js +55 -57
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModelManager.d.ts +76 -0
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModelManager.js +45 -45
- package/vscode/src/vs/workbench/services/textfile/common/textFileSaveParticipant.d.ts +15 -0
- package/vscode/src/vs/workbench/services/textfile/common/textFileSaveParticipant.js +13 -11
- package/files.js +0 -859
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-files-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "VSCode public API plugged on the monaco editor - files service-override",
|
|
4
6
|
"keywords": [],
|
|
5
7
|
"author": {
|
|
6
8
|
"name": "CodinGame",
|
|
@@ -12,8 +14,28 @@
|
|
|
12
14
|
"url": "git+ssh://git@github.com/CodinGame/monaco-vscode-api.git"
|
|
13
15
|
},
|
|
14
16
|
"type": "module",
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@codingame/monaco-vscode-0c06bfba-d24d-5c4d-90cd-b40cefb7f811-common": "12.0.0",
|
|
19
|
+
"@codingame/monaco-vscode-15626ec7-b165-51e1-8caf-7bcc2ae9b95a-common": "12.0.0",
|
|
20
|
+
"@codingame/monaco-vscode-2e67e044-0db9-5fa6-8bd1-3737a7d586d4-common": "12.0.0",
|
|
21
|
+
"@codingame/monaco-vscode-2f06fe84-148e-5e6b-a7ca-c7989c5f128a-common": "12.0.0",
|
|
22
|
+
"@codingame/monaco-vscode-a4683c2b-a0d2-5112-96ba-eedc605346d2-common": "12.0.0",
|
|
23
|
+
"@codingame/monaco-vscode-cea4d01f-6526-5c2f-8b09-b168fead499f-common": "12.0.0",
|
|
24
|
+
"@codingame/monaco-vscode-e571cbbb-526b-5d8b-92c5-a0437d2dabb3-common": "12.0.0",
|
|
25
|
+
"vscode": "npm:@codingame/monaco-vscode-api@12.0.0"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@codingame/monaco-vscode-base-service-override": "12.0.0",
|
|
29
|
+
"@codingame/monaco-vscode-view-common-service-override": "12.0.0"
|
|
30
|
+
},
|
|
31
|
+
"peerDependenciesMeta": {
|
|
32
|
+
"@codingame/monaco-vscode-base-service-override": {
|
|
33
|
+
"optional": true
|
|
34
|
+
},
|
|
35
|
+
"@codingame/monaco-vscode-view-common-service-override": {
|
|
36
|
+
"optional": true
|
|
37
|
+
}
|
|
38
|
+
},
|
|
17
39
|
"main": "index.js",
|
|
18
40
|
"module": "index.js",
|
|
19
41
|
"types": "index.d.ts",
|
|
@@ -22,10 +44,12 @@
|
|
|
22
44
|
"default": "./index.js"
|
|
23
45
|
},
|
|
24
46
|
"./vscode/*": {
|
|
25
|
-
"default": "./vscode/src/*.js"
|
|
47
|
+
"default": "./vscode/src/*.js",
|
|
48
|
+
"types": "./vscode/src/*.d.ts"
|
|
49
|
+
},
|
|
50
|
+
"./*": {
|
|
51
|
+
"default": "./*.js",
|
|
52
|
+
"types": "./*.d.ts"
|
|
26
53
|
}
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@11.1.2"
|
|
30
54
|
}
|
|
31
55
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Event } from "vscode/vscode/vs/base/common/event";
|
|
2
|
+
import { Disposable, IDisposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
4
|
+
import { IFileDeleteOptions, IFileOverwriteOptions, FileSystemProviderCapabilities, FileType, IFileWriteOptions, IFileChange, IFileSystemProviderWithFileReadWriteCapability, IStat, IWatchOptions } from "vscode/vscode/vs/platform/files/common/files";
|
|
5
|
+
import { IndexedDB } from "@codingame/monaco-vscode-2f06fe84-148e-5e6b-a7ca-c7989c5f128a-common/vscode/vs/base/browser/indexedDB";
|
|
6
|
+
export type IndexedDBFileSystemProviderErrorDataClassification = {
|
|
7
|
+
owner: "sandy081";
|
|
8
|
+
comment: "Information about errors that occur in the IndexedDB file system provider";
|
|
9
|
+
readonly scheme: {
|
|
10
|
+
classification: "SystemMetaData";
|
|
11
|
+
purpose: "FeatureInsight";
|
|
12
|
+
comment: "IndexedDB file system provider scheme for which this error occurred";
|
|
13
|
+
};
|
|
14
|
+
readonly operation: {
|
|
15
|
+
classification: "SystemMetaData";
|
|
16
|
+
purpose: "FeatureInsight";
|
|
17
|
+
comment: "operation during which this error occurred";
|
|
18
|
+
};
|
|
19
|
+
readonly code: {
|
|
20
|
+
classification: "SystemMetaData";
|
|
21
|
+
purpose: "PerformanceAndHealth";
|
|
22
|
+
comment: "error code";
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type IndexedDBFileSystemProviderErrorData = {
|
|
26
|
+
readonly scheme: string;
|
|
27
|
+
readonly operation: string;
|
|
28
|
+
readonly code: string;
|
|
29
|
+
};
|
|
30
|
+
type DirEntry = [
|
|
31
|
+
string,
|
|
32
|
+
FileType
|
|
33
|
+
];
|
|
34
|
+
export declare class IndexedDBFileSystemProvider extends Disposable implements IFileSystemProviderWithFileReadWriteCapability {
|
|
35
|
+
readonly scheme: string;
|
|
36
|
+
private indexedDB;
|
|
37
|
+
private readonly store;
|
|
38
|
+
readonly capabilities: FileSystemProviderCapabilities;
|
|
39
|
+
readonly onDidChangeCapabilities: Event<void>;
|
|
40
|
+
private readonly extUri;
|
|
41
|
+
private readonly changesBroadcastChannel;
|
|
42
|
+
private readonly _onDidChangeFile;
|
|
43
|
+
readonly onDidChangeFile: Event<readonly IFileChange[]>;
|
|
44
|
+
private readonly _onReportError;
|
|
45
|
+
readonly onReportError: Event<IndexedDBFileSystemProviderErrorData>;
|
|
46
|
+
private readonly mtimes;
|
|
47
|
+
private cachedFiletree;
|
|
48
|
+
private writeManyThrottler;
|
|
49
|
+
constructor(scheme: string, indexedDB: IndexedDB, store: string, watchCrossWindowChanges: boolean);
|
|
50
|
+
watch(resource: URI, opts: IWatchOptions): IDisposable;
|
|
51
|
+
mkdir(resource: URI): Promise<void>;
|
|
52
|
+
stat(resource: URI): Promise<IStat>;
|
|
53
|
+
readdir(resource: URI): Promise<DirEntry[]>;
|
|
54
|
+
readFile(resource: URI): Promise<Uint8Array>;
|
|
55
|
+
writeFile(resource: URI, content: Uint8Array, opts: IFileWriteOptions): Promise<void>;
|
|
56
|
+
rename(from: URI, to: URI, opts: IFileOverwriteOptions): Promise<void>;
|
|
57
|
+
delete(resource: URI, opts: IFileDeleteOptions): Promise<void>;
|
|
58
|
+
private tree;
|
|
59
|
+
private triggerChanges;
|
|
60
|
+
private getFiletree;
|
|
61
|
+
private bulkWrite;
|
|
62
|
+
private fileWriteBatch;
|
|
63
|
+
private writeMany;
|
|
64
|
+
private deleteKeys;
|
|
65
|
+
reset(): Promise<void>;
|
|
66
|
+
private reportError;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
import { Throttler } from 'vscode/vscode/vs/base/common/async';
|
|
2
3
|
import { VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
|
|
3
4
|
import { Event, Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
@@ -6,17 +7,17 @@ import { ExtUri } from 'vscode/vscode/vs/base/common/resources';
|
|
|
6
7
|
import { isString } from 'vscode/vscode/vs/base/common/types';
|
|
7
8
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
8
9
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
9
|
-
import { createFileSystemProviderError, FileSystemProviderErrorCode, FileType, FileSystemProviderError } from 'vscode/vscode/vs/platform/files/common/files';
|
|
10
|
-
import { DBClosedError } from 'vscode/vscode/vs/base/browser/indexedDB';
|
|
11
|
-
import { BroadcastDataChannel } from 'vscode/vscode/vs/base/browser/broadcast';
|
|
10
|
+
import { createFileSystemProviderError, FileSystemProviderErrorCode, FileType, FileSystemProviderCapabilities, FileChangeType, FileSystemProviderError } from 'vscode/vscode/vs/platform/files/common/files';
|
|
11
|
+
import { DBClosedError } from '@codingame/monaco-vscode-2f06fe84-148e-5e6b-a7ca-c7989c5f128a-common/vscode/vs/base/browser/indexedDB';
|
|
12
|
+
import { BroadcastDataChannel } from '@codingame/monaco-vscode-e571cbbb-526b-5d8b-92c5-a0437d2dabb3-common/vscode/vs/base/browser/broadcast';
|
|
12
13
|
|
|
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(
|
|
14
|
+
const ERR_FILE_NOT_FOUND = createFileSystemProviderError(( localize(1741, "File does not exist")), FileSystemProviderErrorCode.FileNotFound);
|
|
15
|
+
const ERR_FILE_IS_DIR = createFileSystemProviderError(( localize(1742, "File is Directory")), FileSystemProviderErrorCode.FileIsADirectory);
|
|
16
|
+
const ERR_FILE_NOT_DIR = createFileSystemProviderError(( localize(1743, "File is not a directory")), FileSystemProviderErrorCode.FileNotADirectory);
|
|
17
|
+
const ERR_DIR_NOT_EMPTY = createFileSystemProviderError(( localize(1744, "Directory is not empty")), FileSystemProviderErrorCode.Unknown);
|
|
18
|
+
const ERR_FILE_EXCEEDS_STORAGE_QUOTA = createFileSystemProviderError(( localize(1745, "File exceeds available storage quota")), FileSystemProviderErrorCode.FileExceedsStorageQuota);
|
|
18
19
|
const ERR_UNKNOWN_INTERNAL = (message) => createFileSystemProviderError(( localize(
|
|
19
|
-
|
|
20
|
+
1746,
|
|
20
21
|
"Internal error occurred in IndexedDB File System Provider. ({0})",
|
|
21
22
|
message
|
|
22
23
|
)), FileSystemProviderErrorCode.Unknown);
|
|
@@ -88,32 +89,32 @@ class IndexedDBFileSystemNode {
|
|
|
88
89
|
if (existing?.entry.type === FileType.File) {
|
|
89
90
|
throw ERR_UNKNOWN_INTERNAL(`Internal error creating IndexedDBFSNode -- overwriting file with directory: ${this.entry.path}/${next} (encountered while adding ${originalPath})`);
|
|
90
91
|
}
|
|
91
|
-
this.entry.children.set(next, existing ?? (
|
|
92
|
+
this.entry.children.set(next, existing ?? ( new IndexedDBFileSystemNode({
|
|
92
93
|
type: FileType.Directory,
|
|
93
94
|
path: this.entry.path + '/' + next,
|
|
94
|
-
children: (
|
|
95
|
-
})))
|
|
95
|
+
children: ( new Map()),
|
|
96
|
+
})));
|
|
96
97
|
}
|
|
97
98
|
else {
|
|
98
99
|
if (existing?.entry.type === FileType.Directory) {
|
|
99
100
|
throw ERR_UNKNOWN_INTERNAL(`Internal error creating IndexedDBFSNode -- overwriting directory with file: ${this.entry.path}/${next} (encountered while adding ${originalPath})`);
|
|
100
101
|
}
|
|
101
|
-
this.entry.children.set(next, (
|
|
102
|
+
this.entry.children.set(next, ( new IndexedDBFileSystemNode({
|
|
102
103
|
type: FileType.File,
|
|
103
104
|
path: this.entry.path + '/' + next,
|
|
104
105
|
size: entry.size,
|
|
105
|
-
})))
|
|
106
|
+
})));
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
109
|
else if (pathParts.length > 1) {
|
|
109
110
|
const next = pathParts[0];
|
|
110
111
|
let childNode = this.entry.children.get(next);
|
|
111
112
|
if (!childNode) {
|
|
112
|
-
childNode = (
|
|
113
|
-
children: (
|
|
113
|
+
childNode = ( new IndexedDBFileSystemNode({
|
|
114
|
+
children: ( new Map()),
|
|
114
115
|
path: this.entry.path + '/' + next,
|
|
115
116
|
type: FileType.Directory
|
|
116
|
-
}))
|
|
117
|
+
}));
|
|
117
118
|
this.entry.children.set(next, childNode);
|
|
118
119
|
}
|
|
119
120
|
else if (childNode.type === FileType.File) {
|
|
@@ -135,21 +136,21 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
135
136
|
this.scheme = scheme;
|
|
136
137
|
this.indexedDB = indexedDB;
|
|
137
138
|
this.store = store;
|
|
138
|
-
this.capabilities =
|
|
139
|
-
|
|
|
139
|
+
this.capabilities = FileSystemProviderCapabilities.FileReadWrite
|
|
140
|
+
| FileSystemProviderCapabilities.PathCaseSensitive;
|
|
140
141
|
this.onDidChangeCapabilities = Event.None;
|
|
141
|
-
this.extUri = (
|
|
142
|
-
this._onDidChangeFile = this._register((
|
|
142
|
+
this.extUri = ( new ExtUri(() => false)) ;
|
|
143
|
+
this._onDidChangeFile = this._register(( new Emitter()));
|
|
143
144
|
this.onDidChangeFile = this._onDidChangeFile.event;
|
|
144
|
-
this._onReportError = this._register((
|
|
145
|
+
this._onReportError = this._register(( new Emitter()));
|
|
145
146
|
this.onReportError = this._onReportError.event;
|
|
146
|
-
this.mtimes = (
|
|
147
|
+
this.mtimes = ( new Map());
|
|
147
148
|
this.fileWriteBatch = [];
|
|
148
|
-
this.writeManyThrottler = (
|
|
149
|
+
this.writeManyThrottler = ( new Throttler());
|
|
149
150
|
if (watchCrossWindowChanges) {
|
|
150
|
-
this.changesBroadcastChannel = this._register((
|
|
151
|
+
this.changesBroadcastChannel = this._register(( new BroadcastDataChannel(`vscode.indexedDB.${scheme}.changes`)));
|
|
151
152
|
this._register(this.changesBroadcastChannel.onDidReceiveData(changes => {
|
|
152
|
-
this._onDidChangeFile.fire((
|
|
153
|
+
this._onDidChangeFile.fire(( changes.map(c => ({ type: c.type, resource: URI.revive(c.resource) }))));
|
|
153
154
|
}));
|
|
154
155
|
}
|
|
155
156
|
}
|
|
@@ -172,7 +173,7 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
172
173
|
return {
|
|
173
174
|
type: FileType.File,
|
|
174
175
|
ctime: 0,
|
|
175
|
-
mtime: this.mtimes.get((
|
|
176
|
+
mtime: this.mtimes.get(( resource.toString())) || 0,
|
|
176
177
|
size: entry.size ?? (await this.readFile(resource)).byteLength
|
|
177
178
|
};
|
|
178
179
|
}
|
|
@@ -196,9 +197,7 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
196
197
|
throw ERR_FILE_NOT_DIR;
|
|
197
198
|
}
|
|
198
199
|
else {
|
|
199
|
-
return (
|
|
200
|
-
([...entry.children.entries()].map(([name, node]) => [name, node.type]))
|
|
201
|
-
);
|
|
200
|
+
return ( [...entry.children.entries()].map(([name, node]) => [name, node.type]));
|
|
202
201
|
}
|
|
203
202
|
}
|
|
204
203
|
catch (error) {
|
|
@@ -267,7 +266,7 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
267
266
|
}
|
|
268
267
|
if (sourceFiles.length) {
|
|
269
268
|
const targetFiles = [];
|
|
270
|
-
const sourceFilesContents = await this.indexedDB.runInTransaction(this.store, 'readonly', objectStore => (
|
|
269
|
+
const sourceFilesContents = await this.indexedDB.runInTransaction(this.store, 'readonly', objectStore => ( sourceFiles.map(([path]) => objectStore.get(path))));
|
|
271
270
|
for (let index = 0; index < sourceFiles.length; index++) {
|
|
272
271
|
const content = sourceFilesContents[index] instanceof Uint8Array ? sourceFilesContents[index] : isString(sourceFilesContents[index]) ? VSBuffer.fromString(sourceFilesContents[index]).buffer : undefined;
|
|
273
272
|
if (content) {
|
|
@@ -292,7 +291,7 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
292
291
|
let toDelete;
|
|
293
292
|
if (opts.recursive) {
|
|
294
293
|
const tree = await this.tree(resource);
|
|
295
|
-
toDelete = (
|
|
294
|
+
toDelete = ( tree.map(([path]) => path));
|
|
296
295
|
}
|
|
297
296
|
else {
|
|
298
297
|
if (stat.type === FileType.Directory && (await this.readdir(resource)).length) {
|
|
@@ -303,9 +302,9 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
303
302
|
await this.deleteKeys(toDelete);
|
|
304
303
|
(await this.getFiletree()).delete(resource.path);
|
|
305
304
|
toDelete.forEach(key => this.mtimes.delete(key));
|
|
306
|
-
this.triggerChanges((
|
|
307
|
-
path => ({ resource: resource.with({ path }), type:
|
|
308
|
-
)))
|
|
305
|
+
this.triggerChanges(( toDelete.map(
|
|
306
|
+
path => ({ resource: resource.with({ path }), type: FileChangeType.DELETED })
|
|
307
|
+
)));
|
|
309
308
|
}
|
|
310
309
|
async tree(resource) {
|
|
311
310
|
const stat = await this.stat(resource);
|
|
@@ -332,13 +331,13 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
332
331
|
getFiletree() {
|
|
333
332
|
if (!this.cachedFiletree) {
|
|
334
333
|
this.cachedFiletree = (async () => {
|
|
335
|
-
const rootNode = (
|
|
336
|
-
children: (
|
|
334
|
+
const rootNode = ( new IndexedDBFileSystemNode({
|
|
335
|
+
children: ( new Map()),
|
|
337
336
|
path: '',
|
|
338
337
|
type: FileType.Directory
|
|
339
|
-
}))
|
|
338
|
+
}));
|
|
340
339
|
const result = await this.indexedDB.runInTransaction(this.store, 'readonly', objectStore => objectStore.getAllKeys());
|
|
341
|
-
const keys = (
|
|
340
|
+
const keys = ( result.map(key => ( key.toString())));
|
|
342
341
|
keys.forEach(key => rootNode.add(key, { type: 'file' }));
|
|
343
342
|
return rootNode;
|
|
344
343
|
})();
|
|
@@ -351,17 +350,17 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
351
350
|
const fileTree = await this.getFiletree();
|
|
352
351
|
for (const [resource, content] of files) {
|
|
353
352
|
fileTree.add(resource.path, { type: 'file', size: content.byteLength });
|
|
354
|
-
this.mtimes.set((
|
|
353
|
+
this.mtimes.set(( resource.toString()), Date.now());
|
|
355
354
|
}
|
|
356
|
-
this.triggerChanges((
|
|
355
|
+
this.triggerChanges(( files.map(([resource]) => ({ resource, type: FileChangeType.UPDATED }))));
|
|
357
356
|
}
|
|
358
357
|
async writeMany() {
|
|
359
358
|
if (this.fileWriteBatch.length) {
|
|
360
359
|
const fileBatch = this.fileWriteBatch.splice(0, this.fileWriteBatch.length);
|
|
361
360
|
try {
|
|
362
|
-
await this.indexedDB.runInTransaction(this.store, 'readwrite', objectStore => (
|
|
361
|
+
await this.indexedDB.runInTransaction(this.store, 'readwrite', objectStore => ( fileBatch.map(entry => {
|
|
363
362
|
return objectStore.put(entry.content, entry.resource.path);
|
|
364
|
-
})))
|
|
363
|
+
})));
|
|
365
364
|
}
|
|
366
365
|
catch (ex) {
|
|
367
366
|
if (ex instanceof DOMException && ex.name === 'QuotaExceededError') {
|
|
@@ -373,7 +372,7 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
373
372
|
}
|
|
374
373
|
async deleteKeys(keys) {
|
|
375
374
|
if (keys.length) {
|
|
376
|
-
await this.indexedDB.runInTransaction(this.store, 'readwrite', objectStore => (
|
|
375
|
+
await this.indexedDB.runInTransaction(this.store, 'readwrite', objectStore => ( keys.map(key => objectStore.delete(key))));
|
|
377
376
|
}
|
|
378
377
|
}
|
|
379
378
|
async reset() {
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { VSBuffer, VSBufferReadable, VSBufferReadableStream } from "vscode/vscode/vs/base/common/buffer";
|
|
2
|
+
import { CancellationToken } from "vscode/vscode/vs/base/common/cancellation";
|
|
3
|
+
import { Disposable, IDisposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
4
|
+
import { IExtUri } from "vscode/vscode/vs/base/common/resources";
|
|
5
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
6
|
+
import { FileChangesEvent, IFileDeleteOptions, FileOperationEvent, FileSystemProviderCapabilities, ICreateFileOptions, IFileContent, IFileStat, IFileStatWithMetadata, IFileStreamContent, IFileSystemProvider, IFileSystemProviderActivationEvent, IFileSystemProviderCapabilitiesChangeEvent, IFileSystemProviderRegistrationEvent, IReadFileOptions, IReadFileStreamOptions, IResolveFileOptions, IFileStatResult, IFileStatResultWithMetadata, IResolveMetadataFileOptions, IFileStatWithPartialMetadata, IWriteFileOptions, IWatchOptionsWithCorrelation, IFileSystemWatcher, IWatchOptionsWithoutCorrelation } from "vscode/vscode/vs/platform/files/common/files";
|
|
7
|
+
import { IFileService } from "vscode/vscode/vs/platform/files/common/files.service";
|
|
8
|
+
import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
|
|
9
|
+
export declare function mkdirp(providerExtUri: IExtUri, provider: IFileSystemProvider, directory: URI): Promise<void>;
|
|
10
|
+
export declare class FileService extends Disposable implements IFileService {
|
|
11
|
+
private readonly logService;
|
|
12
|
+
readonly _serviceBrand: undefined;
|
|
13
|
+
private readonly BUFFER_SIZE;
|
|
14
|
+
constructor(logService: ILogService);
|
|
15
|
+
private readonly _onDidChangeFileSystemProviderRegistrations;
|
|
16
|
+
readonly onDidChangeFileSystemProviderRegistrations: import("vscode/vscode/vs/base/common/event").Event<IFileSystemProviderRegistrationEvent>;
|
|
17
|
+
private readonly _onWillActivateFileSystemProvider;
|
|
18
|
+
readonly onWillActivateFileSystemProvider: import("vscode/vscode/vs/base/common/event").Event<IFileSystemProviderActivationEvent>;
|
|
19
|
+
private readonly _onDidChangeFileSystemProviderCapabilities;
|
|
20
|
+
readonly onDidChangeFileSystemProviderCapabilities: import("vscode/vscode/vs/base/common/event").Event<IFileSystemProviderCapabilitiesChangeEvent>;
|
|
21
|
+
private readonly provider;
|
|
22
|
+
registerProvider(scheme: string, provider: IFileSystemProvider): IDisposable;
|
|
23
|
+
getProvider(scheme: string): IFileSystemProvider | undefined;
|
|
24
|
+
activateProvider(scheme: string): Promise<void>;
|
|
25
|
+
canHandleResource(resource: URI): Promise<boolean>;
|
|
26
|
+
hasProvider(resource: URI): boolean;
|
|
27
|
+
hasCapability(resource: URI, capability: FileSystemProviderCapabilities): boolean;
|
|
28
|
+
listCapabilities(): Iterable<{
|
|
29
|
+
scheme: string;
|
|
30
|
+
capabilities: FileSystemProviderCapabilities;
|
|
31
|
+
}>;
|
|
32
|
+
protected withProvider(resource: URI): Promise<IFileSystemProvider>;
|
|
33
|
+
private withReadProvider;
|
|
34
|
+
private withWriteProvider;
|
|
35
|
+
private readonly _onDidRunOperation;
|
|
36
|
+
readonly onDidRunOperation: import("vscode/vscode/vs/base/common/event").Event<FileOperationEvent>;
|
|
37
|
+
resolve(resource: URI, options: IResolveMetadataFileOptions): Promise<IFileStatWithMetadata>;
|
|
38
|
+
resolve(resource: URI, options?: IResolveFileOptions): Promise<IFileStat>;
|
|
39
|
+
private doResolveFile;
|
|
40
|
+
private toFileStat;
|
|
41
|
+
resolveAll(toResolve: {
|
|
42
|
+
resource: URI;
|
|
43
|
+
options?: IResolveFileOptions;
|
|
44
|
+
}[]): Promise<IFileStatResult[]>;
|
|
45
|
+
resolveAll(toResolve: {
|
|
46
|
+
resource: URI;
|
|
47
|
+
options: IResolveMetadataFileOptions;
|
|
48
|
+
}[]): Promise<IFileStatResultWithMetadata[]>;
|
|
49
|
+
stat(resource: URI): Promise<IFileStatWithPartialMetadata>;
|
|
50
|
+
exists(resource: URI): Promise<boolean>;
|
|
51
|
+
canCreateFile(resource: URI, options?: ICreateFileOptions): Promise<Error | true>;
|
|
52
|
+
private doValidateCreateFile;
|
|
53
|
+
createFile(resource: URI, bufferOrReadableOrStream?: VSBuffer | VSBufferReadable | VSBufferReadableStream, options?: ICreateFileOptions): Promise<IFileStatWithMetadata>;
|
|
54
|
+
writeFile(resource: URI, bufferOrReadableOrStream: VSBuffer | VSBufferReadable | VSBufferReadableStream, options?: IWriteFileOptions): Promise<IFileStatWithMetadata>;
|
|
55
|
+
private validateWriteFile;
|
|
56
|
+
readFile(resource: URI, options?: IReadFileOptions, token?: CancellationToken): Promise<IFileContent>;
|
|
57
|
+
private doReadFileAtomic;
|
|
58
|
+
private doReadFile;
|
|
59
|
+
readFileStream(resource: URI, options?: IReadFileStreamOptions, token?: CancellationToken): Promise<IFileStreamContent>;
|
|
60
|
+
private doReadFileStream;
|
|
61
|
+
private restoreReadError;
|
|
62
|
+
private readFileStreamed;
|
|
63
|
+
private readFileBuffered;
|
|
64
|
+
private readFileUnbuffered;
|
|
65
|
+
private validateReadFile;
|
|
66
|
+
private validateReadFileLimits;
|
|
67
|
+
canMove(source: URI, target: URI, overwrite?: boolean): Promise<Error | true>;
|
|
68
|
+
canCopy(source: URI, target: URI, overwrite?: boolean): Promise<Error | true>;
|
|
69
|
+
private doCanMoveCopy;
|
|
70
|
+
move(source: URI, target: URI, overwrite?: boolean): Promise<IFileStatWithMetadata>;
|
|
71
|
+
copy(source: URI, target: URI, overwrite?: boolean): Promise<IFileStatWithMetadata>;
|
|
72
|
+
private doMoveCopy;
|
|
73
|
+
private doCopyFile;
|
|
74
|
+
private doCopyFolder;
|
|
75
|
+
private doValidateMoveCopy;
|
|
76
|
+
private getExtUri;
|
|
77
|
+
private isPathCaseSensitive;
|
|
78
|
+
createFolder(resource: URI): Promise<IFileStatWithMetadata>;
|
|
79
|
+
private mkdirp;
|
|
80
|
+
canDelete(resource: URI, options?: Partial<IFileDeleteOptions>): Promise<Error | true>;
|
|
81
|
+
private doValidateDelete;
|
|
82
|
+
del(resource: URI, options?: Partial<IFileDeleteOptions>): Promise<void>;
|
|
83
|
+
cloneFile(source: URI, target: URI): Promise<void>;
|
|
84
|
+
private readonly internalOnDidFilesChange;
|
|
85
|
+
private readonly _onDidUncorrelatedFilesChange;
|
|
86
|
+
readonly onDidFilesChange: import("vscode/vscode/vs/base/common/event").Event<FileChangesEvent>;
|
|
87
|
+
private readonly _onDidWatchError;
|
|
88
|
+
readonly onDidWatchError: import("vscode/vscode/vs/base/common/event").Event<Error>;
|
|
89
|
+
private readonly activeWatchers;
|
|
90
|
+
private static WATCHER_CORRELATION_IDS;
|
|
91
|
+
createWatcher(resource: URI, options: IWatchOptionsWithoutCorrelation): IFileSystemWatcher;
|
|
92
|
+
watch(resource: URI, options: IWatchOptionsWithCorrelation): IFileSystemWatcher;
|
|
93
|
+
watch(resource: URI, options?: IWatchOptionsWithoutCorrelation): IDisposable;
|
|
94
|
+
private doWatch;
|
|
95
|
+
dispose(): void;
|
|
96
|
+
private readonly writeQueue;
|
|
97
|
+
private doWriteBuffered;
|
|
98
|
+
private doWriteStreamBufferedQueued;
|
|
99
|
+
private doWriteReadableBufferedQueued;
|
|
100
|
+
private doWriteBuffer;
|
|
101
|
+
private doWriteUnbuffered;
|
|
102
|
+
private doWriteUnbufferedQueued;
|
|
103
|
+
private doPipeBuffered;
|
|
104
|
+
private doPipeBufferedQueued;
|
|
105
|
+
private doPipeUnbuffered;
|
|
106
|
+
private doPipeUnbufferedQueued;
|
|
107
|
+
private doPipeUnbufferedToBuffered;
|
|
108
|
+
private doPipeUnbufferedToBufferedQueued;
|
|
109
|
+
private doPipeBufferedToUnbuffered;
|
|
110
|
+
protected throwIfFileSystemIsReadonly<T extends IFileSystemProvider>(provider: T, resource: URI): T;
|
|
111
|
+
private throwIfFileIsReadonly;
|
|
112
|
+
private resourceForError;
|
|
113
|
+
}
|