diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.fs.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.fs.test.ts index d58bcc2bca98eafb04cbefa5b8a514c1634deda4..06728e206d941b09b56d51deb517e98bdb7180bb 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.fs.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.fs.test.ts @@ -83,7 +83,7 @@ suite('workspace-fs', () => { // ensure non empty folder cannot be deleted try { - await vscode.workspace.fs.delete(folder, { recursive: false }); + await vscode.workspace.fs.delete(folder, { recursive: false, useTrash: false }); assert.ok(false); } catch { await vscode.workspace.fs.stat(folder); @@ -100,7 +100,7 @@ suite('workspace-fs', () => { } // delete non empty folder with recursive-flag - await vscode.workspace.fs.delete(folder, { recursive: true }); + await vscode.workspace.fs.delete(folder, { recursive: true, useTrash: false }); // esnure folder/file are gone try { diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index e182ea0629ccf4445e443ef4323228971d4b2960..41a3463b7b618a12501ee8e3a8dd0d7567efbc10 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -1638,17 +1638,16 @@ declare module 'vscode' { * * @param uri The uri of the file. * @param content The new content of the file. - * @param options Defines if missing files should or must be created. */ - writeFile(uri: Uri, content: Uint8Array, options?: { create: boolean, overwrite: boolean }): Thenable; + writeFile(uri: Uri, content: Uint8Array): Thenable; /** * Delete a file. * * @param uri The resource that is to be deleted. - * @param options Defines if deletion of folders is recursive. + * @param options Defines if trash can should be used and if deletion of folders is recursive */ - delete(uri: Uri, options?: { recursive: boolean }): Thenable; + delete(uri: Uri, options?: { recursive: boolean, useTrash: boolean }): Thenable; /** * Rename a file or folder. diff --git a/src/vs/workbench/api/browser/mainThreadFileSystem.ts b/src/vs/workbench/api/browser/mainThreadFileSystem.ts index 4df264ea14ead4639d5f3475c6bc255471e93b9e..0d232f2870d1842a173b7e4321dc6d045a626a58 100644 --- a/src/vs/workbench/api/browser/mainThreadFileSystem.ts +++ b/src/vs/workbench/api/browser/mainThreadFileSystem.ts @@ -79,9 +79,8 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape { return this._fileService.readFile(URI.revive(uri)).then(file => file.value).catch(MainThreadFileSystem._handleError); } - $writeFile(uri: UriComponents, content: VSBuffer, opts: FileWriteOptions): Promise { - //todo@joh honor opts - return this._fileService.writeFile(URI.revive(uri), content, {}).catch(MainThreadFileSystem._handleError); + $writeFile(uri: UriComponents, content: VSBuffer): Promise { + return this._fileService.writeFile(URI.revive(uri), content).catch(MainThreadFileSystem._handleError); } $rename(source: UriComponents, target: UriComponents, opts: FileOverwriteOptions): Promise { diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 0bdb48ef1c2281d91197be09199bb443b2686b14..99b544184cac5906d5acbb98c385d0bdf0ee0c60 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -612,7 +612,7 @@ export interface MainThreadFileSystemShape extends IDisposable { $stat(uri: UriComponents): Promise; $readdir(resource: UriComponents): Promise<[string, files.FileType][]>; $readFile(resource: UriComponents): Promise; - $writeFile(resource: UriComponents, content: VSBuffer, opts: files.FileWriteOptions): Promise; + $writeFile(resource: UriComponents, content: VSBuffer): Promise; $rename(resource: UriComponents, target: UriComponents, opts: files.FileOverwriteOptions): Promise; $copy(resource: UriComponents, target: UriComponents, opts: files.FileOverwriteOptions): Promise; $mkdir(resource: UriComponents): Promise; diff --git a/src/vs/workbench/api/common/extHostFileSystem.ts b/src/vs/workbench/api/common/extHostFileSystem.ts index ddef167c30770b873e05f70123df889ac7632825..8eae35ee7d8213abcb6f94229d08aef90d3cbe32 100644 --- a/src/vs/workbench/api/common/extHostFileSystem.ts +++ b/src/vs/workbench/api/common/extHostFileSystem.ts @@ -119,11 +119,11 @@ class ConsumerFileSystem implements vscode.FileSystem { async readFile(uri: vscode.Uri): Promise { return this._proxy.$readFile(uri).then(buff => buff.buffer).catch(ConsumerFileSystem._handleError); } - writeFile(uri: vscode.Uri, content: Uint8Array, options: { create: boolean; overwrite: boolean; } = { create: true, overwrite: true }): Promise { - return this._proxy.$writeFile(uri, VSBuffer.wrap(content), options).catch(ConsumerFileSystem._handleError); + writeFile(uri: vscode.Uri, content: Uint8Array): Promise { + return this._proxy.$writeFile(uri, VSBuffer.wrap(content)).catch(ConsumerFileSystem._handleError); } - delete(uri: vscode.Uri, options: { recursive: boolean; } = { recursive: false }): Promise { - return this._proxy.$delete(uri, { ...options, useTrash: false }).catch(ConsumerFileSystem._handleError); //todo@joh useTrash + delete(uri: vscode.Uri, options: { recursive: boolean; useTrash: boolean; } = { recursive: false, useTrash: false }): Promise { + return this._proxy.$delete(uri, options).catch(ConsumerFileSystem._handleError); } rename(oldUri: vscode.Uri, newUri: vscode.Uri, options: { overwrite: boolean; } = { overwrite: false }): Promise { return this._proxy.$rename(oldUri, newUri, options).catch(ConsumerFileSystem._handleError);