diff --git a/src/vs/workbench/api/browser/mainThreadWebview.ts b/src/vs/workbench/api/browser/mainThreadWebview.ts index ee94a7b2007d4081a7d0321cc0de78c332e8ede0..0db614fa9bcbff2a53c5354a7e25069623c6f282 100644 --- a/src/vs/workbench/api/browser/mainThreadWebview.ts +++ b/src/vs/workbench/api/browser/mainThreadWebview.ts @@ -795,6 +795,7 @@ class MainThreadCustomEditorModel extends Disposable implements ICustomEditorMod return undefined; } // TODO: handle save untitled case + // TODO: handle cancellation await createCancelablePromise(token => this._proxy.$onSave(this._editorResource, this.viewType, token)); this.change(() => { this._savePoint = this._currentEditIndex; @@ -804,7 +805,8 @@ class MainThreadCustomEditorModel extends Disposable implements ICustomEditorMod public async saveCustomEditorAs(resource: URI, targetResource: URI, _options?: ISaveOptions): Promise { if (this._editable) { - await this._proxy.$onSaveAs(this._editorResource, this.viewType, targetResource); + // TODO: handle cancellation + await createCancelablePromise(token => this._proxy.$onSaveAs(this._editorResource, this.viewType, targetResource, token)); this.change(() => { this._savePoint = this._currentEditIndex; }); diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index c64dbcef8d95e9718fa747a667f0132042e90be6..08822c2e01bc4cd15115c7f0d43e8f6da1617ef6 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -649,7 +649,7 @@ export interface ExtHostWebviewsShape { $disposeEdits(resourceComponents: UriComponents, viewType: string, editIds: number[]): void; $onSave(resource: UriComponents, viewType: string, cancellation: CancellationToken): Promise; - $onSaveAs(resource: UriComponents, viewType: string, targetResource: UriComponents): Promise; + $onSaveAs(resource: UriComponents, viewType: string, targetResource: UriComponents, cancellation: CancellationToken): Promise; $backup(resource: UriComponents, viewType: string, cancellation: CancellationToken): Promise; diff --git a/src/vs/workbench/api/common/extHostWebview.ts b/src/vs/workbench/api/common/extHostWebview.ts index aced97ccc25ebbbaa3093cf6a06e7c35f58911c7..fdcf7623620eaa9afb3fc22c782515cfdb23eb41 100644 --- a/src/vs/workbench/api/common/extHostWebview.ts +++ b/src/vs/workbench/api/common/extHostWebview.ts @@ -630,10 +630,10 @@ export class ExtHostWebviews implements extHostProtocol.ExtHostWebviewsShape { return delegate.save(document, cancellation); } - async $onSaveAs(resourceComponents: UriComponents, viewType: string, targetResource: UriComponents): Promise { + async $onSaveAs(resourceComponents: UriComponents, viewType: string, targetResource: UriComponents, cancellation: CancellationToken): Promise { const delegate = this.getEditingDelegate(viewType); const document = this.getCustomDocument(viewType, resourceComponents); - return delegate.saveAs(document, URI.revive(targetResource)); + return delegate.saveAs(document, URI.revive(targetResource), cancellation); } async $backup(resourceComponents: UriComponents, viewType: string, cancellation: CancellationToken): Promise {