diff --git a/src/vs/platform/files/common/files.ts b/src/vs/platform/files/common/files.ts index efd44a680a5..9c752093669 100644 --- a/src/vs/platform/files/common/files.ts +++ b/src/vs/platform/files/common/files.ts @@ -182,11 +182,11 @@ export interface IFileSystemProvider { stat(resource: URI): TPromise; read(resource: URI, progress: IProgress): TPromise; write(resource: URI, content: Uint8Array): TPromise; - unlink(resource: URI): TPromise; - rename(resource: URI, target: URI): TPromise; - mkdir(resource: URI): TPromise; + move(from: URI, to: URI): TPromise; + mkdir(resource: URI): TPromise; readdir(resource: URI): TPromise<[URI, IStat][]>; rmdir(resource: URI): TPromise; + unlink(resource: URI): TPromise; } diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 4b63d9f20dc..ee038ba05f5 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -222,11 +222,15 @@ declare module 'vscode' { // todo@remote // Thenable - rename(resource: Uri, target: Uri): Thenable; + move(resource: Uri, target: Uri): Thenable; + + // todo@remote + // helps with performance bigly + // copy?(from: Uri, to: Uri): Thenable; // todo@remote // Thenable - mkdir(resource: Uri): Thenable; + mkdir(resource: Uri): Thenable; readdir(resource: Uri): Thenable<[Uri, FileStat][]>; // todo@remote @@ -237,10 +241,6 @@ declare module 'vscode' { // todo@remote // create(resource: Uri): Thenable; - - // todo@remote - // helps with performance bigly - // copy(from: Uri, to: Uri): Thenable; } export namespace workspace { diff --git a/src/vs/workbench/api/electron-browser/mainThreadFileSystem.ts b/src/vs/workbench/api/electron-browser/mainThreadFileSystem.ts index 106e79e772c..f5d967e6eb4 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadFileSystem.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadFileSystem.ts @@ -103,10 +103,10 @@ class RemoteFileSystemProvider implements IFileSystemProvider { unlink(resource: URI): TPromise { return this._proxy.$unlink(this._handle, resource); } - rename(resource: URI, target: URI): TPromise { - return this._proxy.$rename(this._handle, resource, target); + move(resource: URI, target: URI): TPromise { + return this._proxy.$move(this._handle, resource, target); } - mkdir(resource: URI): TPromise { + mkdir(resource: URI): TPromise { return this._proxy.$mkdir(this._handle, resource); } readdir(resource: URI): TPromise<[URI, IStat][], any> { diff --git a/src/vs/workbench/api/node/extHost.protocol.ts b/src/vs/workbench/api/node/extHost.protocol.ts index 89b49dd8292..2c8be377b23 100644 --- a/src/vs/workbench/api/node/extHost.protocol.ts +++ b/src/vs/workbench/api/node/extHost.protocol.ts @@ -484,8 +484,8 @@ export interface ExtHostFileSystemShape { $read(handle: number, resource: URI): TPromise; $write(handle: number, resource: URI, content: number[]): TPromise; $unlink(handle: number, resource: URI): TPromise; - $rename(handle: number, resource: URI, target: URI): TPromise; - $mkdir(handle: number, resource: URI): TPromise; + $move(handle: number, resource: URI, target: URI): TPromise; + $mkdir(handle: number, resource: URI): TPromise; $readdir(handle: number, resource: URI): TPromise<[URI, IStat][]>; $rmdir(handle: number, resource: URI): TPromise; } diff --git a/src/vs/workbench/api/node/extHostFileSystem.ts b/src/vs/workbench/api/node/extHostFileSystem.ts index 55fb5012fef..9c54bdfcd38 100644 --- a/src/vs/workbench/api/node/extHostFileSystem.ts +++ b/src/vs/workbench/api/node/extHostFileSystem.ts @@ -60,10 +60,10 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape { $unlink(handle: number, resource: URI): TPromise { return TPromise.as(this._provider.get(handle).unlink(resource)); } - $rename(handle: number, resource: URI, target: URI): TPromise { - return TPromise.as(this._provider.get(handle).rename(resource, target)); + $move(handle: number, resource: URI, target: URI): TPromise { + return TPromise.as(this._provider.get(handle).move(resource, target)); } - $mkdir(handle: number, resource: URI): TPromise { + $mkdir(handle: number, resource: URI): TPromise { return TPromise.as(this._provider.get(handle).mkdir(resource)); } $readdir(handle: number, resource: URI): TPromise<[URI, IStat][], any> { diff --git a/src/vs/workbench/services/files/electron-browser/remoteFileService.ts b/src/vs/workbench/services/files/electron-browser/remoteFileService.ts index 7944090af4e..2c11eb22ec3 100644 --- a/src/vs/workbench/services/files/electron-browser/remoteFileService.ts +++ b/src/vs/workbench/services/files/electron-browser/remoteFileService.ts @@ -306,10 +306,10 @@ export class RemoteFileService extends FileService { return super.createFolder(resource); } else { const provider = await this._withProvider(resource); - await provider.mkdir(resource); - const stat = await toIFileStat(provider, [resource, await provider.stat(resource)]); - this._onAfterOperation.fire(new FileOperationEvent(resource, FileOperation.CREATE, stat)); - return stat; + const stat = await provider.mkdir(resource); + const fileStat = await toIFileStat(provider, [resource, stat]); + this._onAfterOperation.fire(new FileOperationEvent(resource, FileOperation.CREATE, fileStat)); + return fileStat; } } @@ -344,10 +344,10 @@ export class RemoteFileService extends FileService { // abort on other errors } } - await provider.rename(source, target); - const stat = await this.resolveFile(target); - this._onAfterOperation.fire(new FileOperationEvent(source, FileOperation.MOVE, stat)); - return stat; + const stat = await provider.move(source, target); + const fileStat = await toIFileStat(provider, [target, stat]); + this._onAfterOperation.fire(new FileOperationEvent(source, FileOperation.MOVE, fileStat)); + return fileStat; } private async _manualMove(source: URI, target: URI, overwrite?: boolean): TPromise {