From 94215f2952bf81d39f3a2be5720e522870d063e5 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 19 Apr 2018 12:28:39 +0200 Subject: [PATCH] catchup with version 8 of the proposed api --- fsprovider-sample/src/fileSystemProvider.ts | 2 +- fsprovider-sample/src/vscode.proposed.d.ts | 31 +++++++++++++-------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/fsprovider-sample/src/fileSystemProvider.ts b/fsprovider-sample/src/fileSystemProvider.ts index 812cf835..eafb8de3 100644 --- a/fsprovider-sample/src/fileSystemProvider.ts +++ b/fsprovider-sample/src/fileSystemProvider.ts @@ -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(); diff --git a/fsprovider-sample/src/vscode.proposed.d.ts b/fsprovider-sample/src/vscode.proposed.d.ts index e6ddc081..ed80eb31 100644 --- a/fsprovider-sample/src/vscode.proposed.d.ts +++ b/fsprovider-sample/src/vscode.proposed.d.ts @@ -84,6 +84,9 @@ declare module 'vscode' { // create(resource: Uri): Thenable; } + /** + * + */ 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; + stat(uri: Uri, options: { /*future: followSymlinks*/ }, token: CancellationToken): FileStat2 | Thenable; /** * 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; + createDirectory(uri: Uri, options: { /*future: permissions?*/ }, token: CancellationToken): FileStat2 | Thenable; /** * 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; + /** + * 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; + /** * 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; - - // todo@remote - // ? useTrash, expose trash - delete(uri: Uri, token: CancellationToken): void | Thenable; } export namespace workspace {