@theia/filesystem 1.26.0-next.4 → 1.26.0-next.44
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/lib/browser/breadcrumbs/filepath-breadcrumbs-container.d.ts +1 -2
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-container.d.ts.map +1 -1
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-container.js +3 -4
- package/lib/browser/breadcrumbs/filepath-breadcrumbs-container.js.map +1 -1
- package/lib/browser/file-service.d.ts +5 -0
- package/lib/browser/file-service.d.ts.map +1 -1
- package/lib/browser/file-service.js +5 -0
- package/lib/browser/file-service.js.map +1 -1
- package/lib/browser/file-tree/file-tree-decorator-adapter.d.ts +1 -1
- package/lib/browser/file-tree/file-tree-decorator-adapter.js +1 -1
- package/lib/browser/file-tree/file-tree-widget.js +1 -1
- package/lib/browser/file-tree/file-tree-widget.js.map +1 -1
- package/lib/browser/file-tree/file-tree.d.ts +1 -2
- package/lib/browser/file-tree/file-tree.d.ts.map +1 -1
- package/lib/browser/file-tree/file-tree.js.map +1 -1
- package/lib/browser/filesystem-frontend-module.d.ts.map +1 -1
- package/lib/browser/filesystem-frontend-module.js +0 -165
- package/lib/browser/filesystem-frontend-module.js.map +1 -1
- package/lib/browser/index.d.ts +0 -1
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +0 -1
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/location/location-renderer.js +2 -2
- package/lib/browser/location/location-renderer.js.map +1 -1
- package/lib/common/files.d.ts +13 -4
- package/lib/common/files.d.ts.map +1 -1
- package/lib/common/files.js.map +1 -1
- package/lib/common/filesystem-utils.spec.js +49 -49
- package/lib/common/filesystem-utils.spec.js.map +1 -1
- package/lib/common/filesystem-watcher-protocol.d.ts +1 -22
- package/lib/common/filesystem-watcher-protocol.d.ts.map +1 -1
- package/lib/common/filesystem-watcher-protocol.js +1 -68
- package/lib/common/filesystem-watcher-protocol.js.map +1 -1
- package/lib/common/filesystem.d.ts +0 -229
- package/lib/common/filesystem.d.ts.map +1 -1
- package/lib/common/filesystem.js +1 -51
- package/lib/common/filesystem.js.map +1 -1
- package/lib/common/remote-file-system-provider.d.ts +9 -9
- package/lib/common/remote-file-system-provider.d.ts.map +1 -1
- package/lib/common/remote-file-system-provider.js +9 -10
- package/lib/common/remote-file-system-provider.js.map +1 -1
- package/package.json +3 -3
- package/src/browser/breadcrumbs/filepath-breadcrumbs-container.ts +1 -2
- package/src/browser/file-service.ts +5 -0
- package/src/browser/file-tree/file-tree-decorator-adapter.ts +1 -1
- package/src/browser/file-tree/file-tree-widget.tsx +1 -1
- package/src/browser/file-tree/file-tree.ts +1 -2
- package/src/browser/filesystem-frontend-module.ts +0 -162
- package/src/browser/index.ts +0 -1
- package/src/browser/location/location-renderer.tsx +2 -2
- package/src/common/files.ts +13 -4
- package/src/common/filesystem-utils.spec.ts +1 -1
- package/src/common/filesystem-watcher-protocol.ts +1 -67
- package/src/common/filesystem.ts +0 -262
- package/src/common/remote-file-system-provider.ts +18 -19
- package/lib/browser/filesystem-watcher.d.ts +0 -134
- package/lib/browser/filesystem-watcher.d.ts.map +0 -1
- package/lib/browser/filesystem-watcher.js +0 -240
- package/lib/browser/filesystem-watcher.js.map +0 -1
- package/lib/node/node-file-upload.d.ts +0 -19
- package/lib/node/node-file-upload.d.ts.map +0 -1
- package/lib/node/node-file-upload.js +0 -55
- package/lib/node/node-file-upload.js.map +0 -1
- package/lib/node/nsfw-watcher/nsfw-filesystem-watcher.d.ts +0 -53
- package/lib/node/nsfw-watcher/nsfw-filesystem-watcher.d.ts.map +0 -1
- package/lib/node/nsfw-watcher/nsfw-filesystem-watcher.js +0 -197
- package/lib/node/nsfw-watcher/nsfw-filesystem-watcher.js.map +0 -1
- package/src/browser/filesystem-watcher.ts +0 -249
- package/src/node/node-file-upload.ts +0 -64
- package/src/node/nsfw-watcher/nsfw-filesystem-watcher.ts +0 -255
package/src/common/filesystem.ts
CHANGED
|
@@ -14,182 +14,6 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
/* eslint-disable max-len */
|
|
18
|
-
|
|
19
|
-
import { TextDocumentContentChangeEvent } from '@theia/core/shared/vscode-languageserver-protocol';
|
|
20
|
-
import { ApplicationError } from '@theia/core/lib/common';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService` instead
|
|
24
|
-
*/
|
|
25
|
-
export const FileSystem = Symbol('FileSystem');
|
|
26
|
-
export interface FileSystem {
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Returns the file stat for the given URI.
|
|
30
|
-
*
|
|
31
|
-
* If the uri points to a folder it will contain one level of unresolved children.
|
|
32
|
-
*
|
|
33
|
-
* `undefined` if a file for the given URI does not exist.
|
|
34
|
-
*
|
|
35
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.resolve` instead
|
|
36
|
-
*/
|
|
37
|
-
getFileStat(uri: string): Promise<FileStat | undefined>;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Finds out if a file identified by the resource exists.
|
|
41
|
-
*
|
|
42
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.exists` instead
|
|
43
|
-
*/
|
|
44
|
-
exists(uri: string): Promise<boolean>;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Resolve the contents of a file identified by the resource.
|
|
48
|
-
*
|
|
49
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.read` instead
|
|
50
|
-
*/
|
|
51
|
-
resolveContent(uri: string, options?: { encoding?: string }): Promise<{ stat: FileStat, content: string }>;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Updates the content replacing its previous value.
|
|
55
|
-
*
|
|
56
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.write` instead
|
|
57
|
-
*/
|
|
58
|
-
setContent(file: FileStat, content: string, options?: { encoding?: string }): Promise<FileStat>;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Updates the content replacing its previous value.
|
|
62
|
-
*
|
|
63
|
-
* The optional parameter `overwriteEncoding` can be used to transform the encoding of a file.
|
|
64
|
-
*
|
|
65
|
-
* | | encoding | overwriteEncoding | behaviour |
|
|
66
|
-
* |---|----------|-------------------|-----------|
|
|
67
|
-
* | 1 | undefined | undefined | read & write file in default encoding |
|
|
68
|
-
* | 2 | undefined | ✓ | read file in default encoding; write file in `overwriteEncoding` |
|
|
69
|
-
* | 3 | ✓ | undefined | read & write file in `encoding` |
|
|
70
|
-
* | 4 | ✓ | ✓ | read file in `encoding`; write file in `overwriteEncoding` |
|
|
71
|
-
*
|
|
72
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.write` instead
|
|
73
|
-
*/
|
|
74
|
-
updateContent(file: FileStat, contentChanges: TextDocumentContentChangeEvent[], options?: { encoding?: string, overwriteEncoding?: string }): Promise<FileStat>;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Moves the file to a new path identified by the resource.
|
|
78
|
-
*
|
|
79
|
-
* The optional parameter overwrite can be set to replace an existing file at the location.
|
|
80
|
-
*
|
|
81
|
-
* | | missing | file | empty dir | dir |
|
|
82
|
-
* |-----------|---------|------|-----------|-----------|
|
|
83
|
-
* | missing | x | x | x | x |
|
|
84
|
-
* | file | ✓ | x | x | x |
|
|
85
|
-
* | empty dir | ✓ | x | x | overwrite |
|
|
86
|
-
* | dir | ✓ | x | overwrite | overwrite |
|
|
87
|
-
*
|
|
88
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.move` instead
|
|
89
|
-
*/
|
|
90
|
-
move(sourceUri: string, targetUri: string, options?: FileMoveOptions): Promise<FileStat>;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Copies the file to a path identified by the resource.
|
|
94
|
-
*
|
|
95
|
-
* The optional parameter overwrite can be set to replace an existing file at the location.
|
|
96
|
-
*
|
|
97
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.copy` instead
|
|
98
|
-
*/
|
|
99
|
-
copy(sourceUri: string, targetUri: string, options?: { overwrite?: boolean, recursive?: boolean }): Promise<FileStat>;
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Creates a new file with the given path. The returned promise
|
|
103
|
-
* will have the stat model object as a result.
|
|
104
|
-
*
|
|
105
|
-
* The optional parameter content can be used as value to fill into the new file.
|
|
106
|
-
*
|
|
107
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.create` instead
|
|
108
|
-
*/
|
|
109
|
-
createFile(uri: string, options?: { content?: string, encoding?: string }): Promise<FileStat>;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Creates a new folder with the given path. The returned promise
|
|
113
|
-
* will have the stat model object as a result.
|
|
114
|
-
*
|
|
115
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.createFolder` instead
|
|
116
|
-
*/
|
|
117
|
-
createFolder(uri: string): Promise<FileStat>;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Creates a new empty file if the given path does not exist and otherwise
|
|
121
|
-
* will set the mtime and atime of the file to the current date.
|
|
122
|
-
*/
|
|
123
|
-
touchFile(uri: string): Promise<FileStat>;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Deletes the provided file. The optional moveToTrash parameter allows to
|
|
127
|
-
* move the file to trash.
|
|
128
|
-
*
|
|
129
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.delete` instead
|
|
130
|
-
*/
|
|
131
|
-
delete(uri: string, options?: FileDeleteOptions): Promise<void>;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Returns the encoding of the given file resource.
|
|
135
|
-
*
|
|
136
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908) use `FileService.read` without `autoGuessEncoding` option instead
|
|
137
|
-
*/
|
|
138
|
-
getEncoding(uri: string): Promise<string>;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Guess encoding of a given file based on its content.
|
|
142
|
-
*
|
|
143
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.read` with `autoGuessEncoding` option instead
|
|
144
|
-
*/
|
|
145
|
-
guessEncoding(uri: string): Promise<string | undefined>;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Return list of available roots.
|
|
149
|
-
*/
|
|
150
|
-
getRoots(): Promise<FileStat[]>;
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Returns a promise that resolves to a file stat representing the current user's home directory.
|
|
154
|
-
*
|
|
155
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `EnvVariablesServer.getHomeDirUri` instead
|
|
156
|
-
*/
|
|
157
|
-
getCurrentUserHome(): Promise<FileStat | undefined>;
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Resolves to an array of URIs pointing to the available drives on the filesystem.
|
|
161
|
-
*
|
|
162
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `EnvVariablesServer.getDrives` instead
|
|
163
|
-
*/
|
|
164
|
-
getDrives(): Promise<string[]>;
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Tests a user's permissions for the file or directory specified by URI.
|
|
168
|
-
* The mode argument is an optional integer that specifies the accessibility checks to be performed.
|
|
169
|
-
* Check `FileAccess.Constants` for possible values of mode.
|
|
170
|
-
* It is possible to create a mask consisting of the bitwise `OR` of two or more values (e.g. FileAccess.Constants.W_OK | FileAccess.Constants.R_OK).
|
|
171
|
-
* If `mode` is not defined, `FileAccess.Constants.F_OK` will be used instead.
|
|
172
|
-
*
|
|
173
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.access` instead
|
|
174
|
-
*/
|
|
175
|
-
access(uri: string, mode?: number): Promise<boolean>
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Returns the path of the given file URI, specific to the backend's operating system.
|
|
179
|
-
* If the URI is not a file URI, undefined is returned.
|
|
180
|
-
*
|
|
181
|
-
* USE WITH CAUTION: You should always prefer URIs to paths if possible, as they are
|
|
182
|
-
* portable and platform independent. Paths should only be used in cases you directly
|
|
183
|
-
* interact with the OS, e.g. when running a command on the shell.
|
|
184
|
-
*
|
|
185
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.fsPath` instead
|
|
186
|
-
*/
|
|
187
|
-
getFsPath(uri: string): Promise<string | undefined>
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.access` instead
|
|
192
|
-
*/
|
|
193
17
|
export namespace FileAccess {
|
|
194
18
|
|
|
195
19
|
export namespace Constants {
|
|
@@ -215,91 +39,5 @@ export namespace FileAccess {
|
|
|
215
39
|
* This has no effect on Windows (will behave like `FileAccess.F_OK`).
|
|
216
40
|
*/
|
|
217
41
|
export const X_OK: number = 1;
|
|
218
|
-
|
|
219
42
|
}
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export interface FileMoveOptions {
|
|
224
|
-
overwrite?: boolean;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
export interface FileDeleteOptions {
|
|
228
|
-
moveToTrash?: boolean
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* A file resource with meta information.
|
|
233
|
-
*
|
|
234
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileStat` from `@theia/filesystem/lib/common/files` instead
|
|
235
|
-
*/
|
|
236
|
-
export interface FileStat {
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* The URI of the file.
|
|
240
|
-
*/
|
|
241
|
-
uri: string;
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* The last modification of this file.
|
|
245
|
-
*/
|
|
246
|
-
lastModification: number;
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* `true` if the resource is a directory. Otherwise, `false`.
|
|
250
|
-
*/
|
|
251
|
-
isDirectory: boolean;
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* The children of the file stat.
|
|
255
|
-
* If it is `undefined` and `isDirectory` is `true`, then this file stat is unresolved.
|
|
256
|
-
*/
|
|
257
|
-
children?: FileStat[];
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* The size of the file if known.
|
|
261
|
-
*/
|
|
262
|
-
size?: number;
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
export namespace FileStat {
|
|
267
|
-
export function is(candidate: Object | undefined): candidate is FileStat {
|
|
268
|
-
return typeof candidate === 'object' && ('uri' in candidate) && ('lastModification' in candidate) && ('isDirectory' in candidate);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
export function equals(one: object | undefined, other: object | undefined): boolean {
|
|
272
|
-
if (!one || !other || !is(one) || !is(other)) {
|
|
273
|
-
return false;
|
|
274
|
-
}
|
|
275
|
-
return one.uri === other.uri
|
|
276
|
-
&& one.lastModification === other.lastModification
|
|
277
|
-
&& one.isDirectory === other.isDirectory;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileOperationError` instead
|
|
283
|
-
*/
|
|
284
|
-
export namespace FileSystemError {
|
|
285
|
-
export const FileNotFound = ApplicationError.declare(-33000, (uri: string, prefix?: string) => ({
|
|
286
|
-
message: `${prefix ? prefix + ' ' : ''}'${uri}' has not been found.`,
|
|
287
|
-
data: { uri }
|
|
288
|
-
}));
|
|
289
|
-
export const FileExists = ApplicationError.declare(-33001, (uri: string, prefix?: string) => ({
|
|
290
|
-
message: `${prefix ? prefix + ' ' : ''}'${uri}' already exists.`,
|
|
291
|
-
data: { uri }
|
|
292
|
-
}));
|
|
293
|
-
export const FileIsDirectory = ApplicationError.declare(-33002, (uri: string, prefix?: string) => ({
|
|
294
|
-
message: `${prefix ? prefix + ' ' : ''}'${uri}' is a directory.`,
|
|
295
|
-
data: { uri }
|
|
296
|
-
}));
|
|
297
|
-
export const FileNotDirectory = ApplicationError.declare(-33003, (uri: string, prefix?: string) => ({
|
|
298
|
-
message: `${prefix ? prefix + ' ' : ''}'${uri}' is not a directory.`,
|
|
299
|
-
data: { uri }
|
|
300
|
-
}));
|
|
301
|
-
export const FileIsOutOfSync = ApplicationError.declare(-33004, (file: FileStat, stat: FileStat) => ({
|
|
302
|
-
message: `'${file.uri}' is out of sync.`,
|
|
303
|
-
data: { file, stat }
|
|
304
|
-
}));
|
|
305
43
|
}
|
|
@@ -42,11 +42,11 @@ export interface RemoteFileSystemServer extends JsonRpcServer<RemoteFileSystemCl
|
|
|
42
42
|
fsPath(resource: string): Promise<string>;
|
|
43
43
|
open(resource: string, opts: FileOpenOptions): Promise<number>;
|
|
44
44
|
close(fd: number): Promise<void>;
|
|
45
|
-
read(fd: number, pos: number, length: number): Promise<{ bytes:
|
|
45
|
+
read(fd: number, pos: number, length: number): Promise<{ bytes: Uint8Array; bytesRead: number; }>;
|
|
46
46
|
readFileStream(resource: string, opts: FileReadStreamOptions, token: CancellationToken): Promise<number>;
|
|
47
|
-
readFile(resource: string): Promise<
|
|
48
|
-
write(fd: number, pos: number, data:
|
|
49
|
-
writeFile(resource: string, content:
|
|
47
|
+
readFile(resource: string): Promise<Uint8Array>;
|
|
48
|
+
write(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number>;
|
|
49
|
+
writeFile(resource: string, content: Uint8Array, opts: FileWriteOptions): Promise<void>;
|
|
50
50
|
delete(resource: string, opts: FileDeleteOptions): Promise<void>;
|
|
51
51
|
mkdir(resource: string): Promise<void>;
|
|
52
52
|
readdir(resource: string): Promise<[string, FileType][]>;
|
|
@@ -70,7 +70,7 @@ export interface RemoteFileSystemClient {
|
|
|
70
70
|
notifyDidChangeFile(event: { changes: RemoteFileChange[] }): void;
|
|
71
71
|
notifyFileWatchError(): void;
|
|
72
72
|
notifyDidChangeCapabilities(capabilities: FileSystemProviderCapabilities): void;
|
|
73
|
-
onFileStreamData(handle: number, data:
|
|
73
|
+
onFileStreamData(handle: number, data: Uint8Array): void;
|
|
74
74
|
onFileStreamEnd(handle: number, error: RemoteFileStreamError | undefined): void;
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -169,7 +169,7 @@ export class RemoteFileSystemProvider implements Required<FileSystemProvider>, D
|
|
|
169
169
|
this.onFileWatchErrorEmitter.fire();
|
|
170
170
|
},
|
|
171
171
|
notifyDidChangeCapabilities: capabilities => this.setCapabilities(capabilities),
|
|
172
|
-
onFileStreamData: (handle, data) => this.onFileStreamDataEmitter.fire([handle,
|
|
172
|
+
onFileStreamData: (handle, data) => this.onFileStreamDataEmitter.fire([handle, data]),
|
|
173
173
|
onFileStreamEnd: (handle, error) => this.onFileStreamEndEmitter.fire([handle, error])
|
|
174
174
|
});
|
|
175
175
|
const onInitialized = this.server.onDidOpenConnection(() => {
|
|
@@ -224,7 +224,7 @@ export class RemoteFileSystemProvider implements Required<FileSystemProvider>, D
|
|
|
224
224
|
|
|
225
225
|
async readFile(resource: URI): Promise<Uint8Array> {
|
|
226
226
|
const bytes = await this.server.readFile(resource.toString());
|
|
227
|
-
return
|
|
227
|
+
return bytes;
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
readFileStream(resource: URI, opts: FileReadStreamOptions, token: CancellationToken): ReadableStreamEvents<Uint8Array> {
|
|
@@ -264,11 +264,11 @@ export class RemoteFileSystemProvider implements Required<FileSystemProvider>, D
|
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
write(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number> {
|
|
267
|
-
return this.server.write(fd, pos,
|
|
267
|
+
return this.server.write(fd, pos, data, offset, length);
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
writeFile(resource: URI, content: Uint8Array, opts: FileWriteOptions): Promise<void> {
|
|
271
|
-
return this.server.writeFile(resource.toString(),
|
|
271
|
+
return this.server.writeFile(resource.toString(), content, opts);
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
delete(resource: URI, opts: FileDeleteOptions): Promise<void> {
|
|
@@ -412,34 +412,33 @@ export class FileSystemProviderServer implements RemoteFileSystemServer {
|
|
|
412
412
|
throw new Error('not supported');
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
-
async read(fd: number, pos: number, length: number): Promise<{ bytes:
|
|
415
|
+
async read(fd: number, pos: number, length: number): Promise<{ bytes: Uint8Array; bytesRead: number; }> {
|
|
416
416
|
if (hasOpenReadWriteCloseCapability(this.provider)) {
|
|
417
417
|
const buffer = BinaryBuffer.alloc(this.BUFFER_SIZE);
|
|
418
418
|
const bytes = buffer.buffer;
|
|
419
419
|
const bytesRead = await this.provider.read(fd, pos, bytes, 0, length);
|
|
420
|
-
return { bytes
|
|
420
|
+
return { bytes, bytesRead };
|
|
421
421
|
}
|
|
422
422
|
throw new Error('not supported');
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
-
write(fd: number, pos: number, data:
|
|
425
|
+
write(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number> {
|
|
426
426
|
if (hasOpenReadWriteCloseCapability(this.provider)) {
|
|
427
|
-
return this.provider.write(fd, pos,
|
|
427
|
+
return this.provider.write(fd, pos, data, offset, length);
|
|
428
428
|
}
|
|
429
429
|
throw new Error('not supported');
|
|
430
430
|
}
|
|
431
431
|
|
|
432
|
-
async readFile(resource: string): Promise<
|
|
432
|
+
async readFile(resource: string): Promise<Uint8Array> {
|
|
433
433
|
if (hasReadWriteCapability(this.provider)) {
|
|
434
|
-
|
|
435
|
-
return [...buffer.values()];
|
|
434
|
+
return this.provider.readFile(new URI(resource));
|
|
436
435
|
}
|
|
437
436
|
throw new Error('not supported');
|
|
438
437
|
}
|
|
439
438
|
|
|
440
|
-
writeFile(resource: string, content:
|
|
439
|
+
writeFile(resource: string, content: Uint8Array, opts: FileWriteOptions): Promise<void> {
|
|
441
440
|
if (hasReadWriteCapability(this.provider)) {
|
|
442
|
-
return this.provider.writeFile(new URI(resource),
|
|
441
|
+
return this.provider.writeFile(new URI(resource), content, opts);
|
|
443
442
|
}
|
|
444
443
|
throw new Error('not supported');
|
|
445
444
|
}
|
|
@@ -497,7 +496,7 @@ export class FileSystemProviderServer implements RemoteFileSystemServer {
|
|
|
497
496
|
if (hasFileReadStreamCapability(this.provider)) {
|
|
498
497
|
const handle = this.readFileStreamSeq++;
|
|
499
498
|
const stream = this.provider.readFileStream(new URI(resource), opts, token);
|
|
500
|
-
stream.on('data', data => this.client?.onFileStreamData(handle,
|
|
499
|
+
stream.on('data', data => this.client?.onFileStreamData(handle, data));
|
|
501
500
|
stream.on('error', error => {
|
|
502
501
|
const code = error instanceof FileSystemProviderError ? error.code : undefined;
|
|
503
502
|
const { name, message, stack } = error;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
2
|
-
import { Emitter, WaitUntilEvent } from '@theia/core/lib/common/event';
|
|
3
|
-
import URI from '@theia/core/lib/common/uri';
|
|
4
|
-
import { FileChangeType } from '../common/files';
|
|
5
|
-
import { FileService } from './file-service';
|
|
6
|
-
export { FileChangeType };
|
|
7
|
-
export interface FileChange {
|
|
8
|
-
uri: URI;
|
|
9
|
-
type: FileChangeType;
|
|
10
|
-
}
|
|
11
|
-
export declare namespace FileChange {
|
|
12
|
-
function isUpdated(change: FileChange, uri: URI): boolean;
|
|
13
|
-
function isAdded(change: FileChange, uri: URI): boolean;
|
|
14
|
-
function isDeleted(change: FileChange, uri: URI): boolean;
|
|
15
|
-
function isAffected(change: FileChange, uri: URI): boolean;
|
|
16
|
-
function isChanged(change: FileChange, uri: URI): boolean;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileChangesEvent` instead
|
|
20
|
-
*/
|
|
21
|
-
export declare type FileChangeEvent = FileChange[];
|
|
22
|
-
export declare namespace FileChangeEvent {
|
|
23
|
-
function isUpdated(event: FileChangeEvent, uri: URI): boolean;
|
|
24
|
-
function isAdded(event: FileChangeEvent, uri: URI): boolean;
|
|
25
|
-
function isDeleted(event: FileChangeEvent, uri: URI): boolean;
|
|
26
|
-
function isAffected(event: FileChangeEvent, uri: URI): boolean;
|
|
27
|
-
function isChanged(event: FileChangeEvent, uri: URI): boolean;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `UserFileOperationEvent` instead
|
|
31
|
-
*/
|
|
32
|
-
export interface FileMoveEvent extends WaitUntilEvent {
|
|
33
|
-
sourceUri: URI;
|
|
34
|
-
targetUri: URI;
|
|
35
|
-
}
|
|
36
|
-
export declare namespace FileMoveEvent {
|
|
37
|
-
function isRename({ sourceUri, targetUri }: FileMoveEvent): boolean;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `UserFileOperationEvent` instead
|
|
41
|
-
*/
|
|
42
|
-
export interface FileEvent extends WaitUntilEvent {
|
|
43
|
-
uri: URI;
|
|
44
|
-
}
|
|
45
|
-
export declare class FileOperationEmitter<E extends WaitUntilEvent> implements Disposable {
|
|
46
|
-
protected readonly onWillEmitter: Emitter<E>;
|
|
47
|
-
readonly onWill: import("@theia/core/lib/common/event").Event<E>;
|
|
48
|
-
protected readonly onDidFailEmitter: Emitter<E>;
|
|
49
|
-
readonly onDidFail: import("@theia/core/lib/common/event").Event<E>;
|
|
50
|
-
protected readonly onDidEmitter: Emitter<E>;
|
|
51
|
-
readonly onDid: import("@theia/core/lib/common/event").Event<E>;
|
|
52
|
-
protected readonly toDispose: DisposableCollection;
|
|
53
|
-
dispose(): void;
|
|
54
|
-
fireWill(event: Pick<E, Exclude<keyof E, 'waitUntil'>>): Promise<void>;
|
|
55
|
-
fireDid(failed: boolean, event: Pick<E, Exclude<keyof E, 'waitUntil'>>): Promise<void>;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* React to file system events, including calls originating from the
|
|
59
|
-
* application or event coming from the system's filesystem directly
|
|
60
|
-
* (actual file watching).
|
|
61
|
-
*
|
|
62
|
-
* `on(will|did)(create|rename|delete)` events solely come from application
|
|
63
|
-
* usage, not from actual filesystem.
|
|
64
|
-
*
|
|
65
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.watch` instead
|
|
66
|
-
*/
|
|
67
|
-
export declare class FileSystemWatcher implements Disposable {
|
|
68
|
-
protected readonly toDispose: DisposableCollection;
|
|
69
|
-
protected readonly toRestartAll: DisposableCollection;
|
|
70
|
-
protected readonly onFileChangedEmitter: Emitter<FileChangeEvent>;
|
|
71
|
-
/**
|
|
72
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.onDidFilesChange` instead
|
|
73
|
-
*/
|
|
74
|
-
readonly onFilesChanged: import("@theia/core/lib/common/event").Event<FileChangeEvent>;
|
|
75
|
-
protected readonly fileCreateEmitter: FileOperationEmitter<FileEvent>;
|
|
76
|
-
/**
|
|
77
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.onWillRunUserOperation` instead
|
|
78
|
-
*/
|
|
79
|
-
readonly onWillCreate: import("@theia/core/lib/common/event").Event<FileEvent>;
|
|
80
|
-
/**
|
|
81
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.onDidFailUserOperation` instead
|
|
82
|
-
*/
|
|
83
|
-
readonly onDidFailCreate: import("@theia/core/lib/common/event").Event<FileEvent>;
|
|
84
|
-
/**
|
|
85
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908),
|
|
86
|
-
* instead use `FileService.onDidRunUserOperation` for events triggered by user gestures
|
|
87
|
-
* or `FileService.onDidRunOperation` triggered by user gestures and programmatically
|
|
88
|
-
*/
|
|
89
|
-
readonly onDidCreate: import("@theia/core/lib/common/event").Event<FileEvent>;
|
|
90
|
-
protected readonly fileDeleteEmitter: FileOperationEmitter<FileEvent>;
|
|
91
|
-
/**
|
|
92
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.onWillRunUserOperation` instead
|
|
93
|
-
*/
|
|
94
|
-
readonly onWillDelete: import("@theia/core/lib/common/event").Event<FileEvent>;
|
|
95
|
-
/**
|
|
96
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.onDidFailUserOperation` instead
|
|
97
|
-
*/
|
|
98
|
-
readonly onDidFailDelete: import("@theia/core/lib/common/event").Event<FileEvent>;
|
|
99
|
-
/**
|
|
100
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908),
|
|
101
|
-
* instead use `FileService.onDidRunUserOperation` for events triggered by user gestures
|
|
102
|
-
* or `FileService.onDidRunOperation` triggered by user gestures and programmatically
|
|
103
|
-
*/
|
|
104
|
-
readonly onDidDelete: import("@theia/core/lib/common/event").Event<FileEvent>;
|
|
105
|
-
protected readonly fileMoveEmitter: FileOperationEmitter<FileMoveEvent>;
|
|
106
|
-
/**
|
|
107
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.onWillRunUserOperation` instead
|
|
108
|
-
*/
|
|
109
|
-
readonly onWillMove: import("@theia/core/lib/common/event").Event<FileMoveEvent>;
|
|
110
|
-
/**
|
|
111
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.onDidFailUserOperation` instead
|
|
112
|
-
*/
|
|
113
|
-
readonly onDidFailMove: import("@theia/core/lib/common/event").Event<FileMoveEvent>;
|
|
114
|
-
/**
|
|
115
|
-
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908),
|
|
116
|
-
* instead use `FileService.onDidRunUserOperation` for events triggered by user gestures
|
|
117
|
-
* or `FileService.onDidRunOperation` triggered by user gestures and programmatically
|
|
118
|
-
*/
|
|
119
|
-
readonly onDidMove: import("@theia/core/lib/common/event").Event<FileMoveEvent>;
|
|
120
|
-
protected readonly fileService: FileService;
|
|
121
|
-
protected init(): void;
|
|
122
|
-
/**
|
|
123
|
-
* Stop watching.
|
|
124
|
-
*/
|
|
125
|
-
dispose(): void;
|
|
126
|
-
/**
|
|
127
|
-
* Start file watching under the given uri.
|
|
128
|
-
*
|
|
129
|
-
* Resolve when watching is started.
|
|
130
|
-
* Return a disposable to stop file watching under the given uri.
|
|
131
|
-
*/
|
|
132
|
-
watchFileChanges(uri: URI): Promise<Disposable>;
|
|
133
|
-
}
|
|
134
|
-
//# sourceMappingURL=filesystem-watcher.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem-watcher.d.ts","sourceRoot":"","sources":["../../src/browser/filesystem-watcher.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,GAAG,MAAM,4BAA4B,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAiB,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EACH,cAAc,EACjB,CAAC;AAEF,MAAM,WAAW,UAAU;IACvB,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,cAAc,CAAC;CACxB;AACD,yBAAiB,UAAU,CAAC;IACxB,SAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAE/D;IACD,SAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAE7D;IACD,SAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAE/D;IACD,SAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAEhE;IACD,SAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAE/D;CACJ;AAED;;GAEG;AACH,oBAAY,eAAe,GAAG,UAAU,EAAE,CAAC;AAC3C,yBAAiB,eAAe,CAAC;IAC7B,SAAgB,SAAS,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,GAAG,GAA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