提交 433006eb 编写于 作者: J Johannes Rieken

add (empty) option bags to provider function to be save for the future, #47475

上级 54583ac6
......@@ -132,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
......@@ -149,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)
......@@ -164,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.
......@@ -172,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.
......@@ -192,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.
*
......@@ -210,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 {
......
......@@ -59,7 +59,7 @@ class FsLinkProvider implements vscode.DocumentLinkProvider {
class FileSystemProviderShim implements vscode.FileSystemProvider2 {
_version: 7 = 7;
_version: 8 = 8;
onDidChangeFile: vscode.Event<vscode.FileChange2[]>;
......@@ -189,7 +189,7 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
}
registerFileSystemProvider(scheme: string, provider: vscode.FileSystemProvider, newProvider: vscode.FileSystemProvider2) {
if (newProvider && newProvider._version === 7) {
if (newProvider && newProvider._version === 8) {
return this._doRegisterFileSystemProvider(scheme, newProvider);
} else if (provider) {
return this._doRegisterFileSystemProvider(scheme, new FileSystemProviderShim(provider));
......@@ -248,11 +248,11 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
}
$stat(handle: number, resource: UriComponents): TPromise<files.IStat, any> {
return asWinJsPromise(token => this._fsProvider.get(handle).stat(URI.revive(resource), token));
return asWinJsPromise(token => this._fsProvider.get(handle).stat(URI.revive(resource), {}, token));
}
$readdir(handle: number, resource: UriComponents): TPromise<[string, files.IStat][], any> {
return asWinJsPromise(token => this._fsProvider.get(handle).readDirectory(URI.revive(resource), token));
return asWinJsPromise(token => this._fsProvider.get(handle).readDirectory(URI.revive(resource), {}, token));
}
$readFile(handle: number, resource: UriComponents, flags: files.FileOpenFlags): TPromise<string> {
......@@ -268,7 +268,7 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
}
$delete(handle: number, resource: UriComponents): TPromise<void, any> {
return asWinJsPromise(token => this._fsProvider.get(handle).delete(URI.revive(resource), token));
return asWinJsPromise(token => this._fsProvider.get(handle).delete(URI.revive(resource), {}, token));
}
$rename(handle: number, oldUri: UriComponents, newUri: UriComponents, flags: files.FileOpenFlags): TPromise<files.IStat, any> {
......@@ -280,7 +280,7 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
}
$mkdir(handle: number, resource: UriComponents): TPromise<files.IStat, any> {
return asWinJsPromise(token => this._fsProvider.get(handle).createDirectory(URI.revive(resource), token));
return asWinJsPromise(token => this._fsProvider.get(handle).createDirectory(URI.revive(resource), {}, token));
}
$watch(handle: number, session: number, resource: UriComponents, opts: files.IWatchOptions): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册