catchup with version 8 of the proposed api

This commit is contained in:
Johannes Rieken
2018-04-19 12:28:39 +02:00
parent ee95924f96
commit 94215f2952
2 changed files with 20 additions and 13 deletions

View File

@ -46,7 +46,7 @@ type Entry = File | Directory;
export class MemFS implements vscode.FileSystemProvider2 {
_version: 7 = 7;
_version: 8 = 8;
private _root = new Directory('');
private _data = new WeakMap<Entry, Uint8Array>();

View File

@ -84,6 +84,9 @@ declare module 'vscode' {
// create(resource: Uri): Thenable<FileStat>;
}
/**
*
*/
export class FileError extends Error {
static EntryExists(message?: string): FileError;
@ -91,9 +94,7 @@ declare module 'vscode' {
static EntryNotADirectory(message?: string): FileError;
static EntryIsADirectory(message?: string): FileError;
readonly code: string;
constructor(message?: string, code?: string);
constructor(message?: string);
}
export enum FileChangeType2 {
@ -131,7 +132,7 @@ declare module 'vscode' {
*/
export interface FileSystemProvider2 {
_version: 7;
_version: 8;
/**
* An event to signal that a resource has been created, changed, or deleted. This
@ -148,13 +149,14 @@ declare module 'vscode' {
watch(uri: Uri, options: { recursive?: boolean; excludes?: string[] }): Disposable;
/**
* Retrieve metadata about a file.
* Retrieve metadata about a file. Throw an [`EntryNotFound`](#FileError.EntryNotFound)-error
* in case the file does not exist.
*
* @param uri The uri of the file to retrieve meta data about.
* @param token A cancellation token.
* @return The file metadata about the file.
*/
stat(uri: Uri, token: CancellationToken): FileStat2 | Thenable<FileStat2>;
stat(uri: Uri, options: { /*future: followSymlinks*/ }, token: CancellationToken): FileStat2 | Thenable<FileStat2>;
/**
* Retrieve the meta data of all entries of a [directory](#FileType2.Directory)
@ -163,7 +165,7 @@ declare module 'vscode' {
* @param token A cancellation token.
* @return A thenable that resolves to an array of tuples of file names and files stats.
*/
readDirectory(uri: Uri, token: CancellationToken): [string, FileStat2][] | Thenable<[string, FileStat2][]>;
readDirectory(uri: Uri, options: { /*future: onlyType?*/ }, token: CancellationToken): [string, FileStat2][] | Thenable<[string, FileStat2][]>;
/**
* Create a new directory. *Note* that new files are created via `write`-calls.
@ -171,7 +173,7 @@ declare module 'vscode' {
* @param uri The uri of the *new* folder.
* @param token A cancellation token.
*/
createDirectory(uri: Uri, token: CancellationToken): FileStat2 | Thenable<FileStat2>;
createDirectory(uri: Uri, options: { /*future: permissions?*/ }, token: CancellationToken): FileStat2 | Thenable<FileStat2>;
/**
* Read the entire contents of a file.
@ -191,6 +193,15 @@ declare module 'vscode' {
*/
writeFile(uri: Uri, content: Uint8Array, options: { flags: FileOpenFlags }, token: CancellationToken): void | Thenable<void>;
/**
* Delete a file or folder from the underlying storage.
*
* @param uri The resource that is to be deleted
* @param options Options bag for future use
* @param token A cancellation token.
*/
delete(uri: Uri, options: { /*future: useTrash?, followSymlinks?*/ }, token: CancellationToken): void | Thenable<void>;
/**
* Rename a file or folder.
*
@ -209,10 +220,6 @@ declare module 'vscode' {
* @param token A cancellation token.
*/
copy?(uri: Uri, target: Uri, options: { flags: FileOpenFlags }, token: CancellationToken): FileStat2 | Thenable<FileStat2>;
// todo@remote
// ? useTrash, expose trash
delete(uri: Uri, token: CancellationToken): void | Thenable<void>;
}
export namespace workspace {