Working on hooking up custom editor saveAs

This commit is contained in:
Matt Bierner
2019-11-22 16:36:01 -08:00
parent d1fab46c13
commit ffe3749d5a
7 changed files with 104 additions and 7 deletions

View File

@@ -260,6 +260,11 @@ export class ExtHostWebviewEditor extends Disposable implements vscode.WebviewPa
await assertIsDefined(this._capabilities).editingCapability?.save();
}
async _onSaveAs(resource: vscode.Uri, targetResource: vscode.Uri): Promise<void> {
await assertIsDefined(this._capabilities).editingCapability?.saveAs(resource, targetResource);
}
private assertNotDisposed() {
if (this._isDisposed) {
throw new Error('Webview is disposed');
@@ -462,6 +467,11 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
return panel?._onSave();
}
async $onSaveAs(handle: WebviewPanelHandle, resource: UriComponents, targetResource: UriComponents): Promise<void> {
const panel = this.getWebviewPanel(handle);
return panel?._onSaveAs(URI.revive(resource), URI.revive(targetResource));
}
private getWebviewPanel(handle: WebviewPanelHandle): ExtHostWebviewEditor | undefined {
return this._webviewPanels.get(handle);
}