mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 17:23:02 -05:00
Merge from vscode 8b5ebbb1b8f6b2127bbbd551ac10cc080482d5b4 (#5041)
This commit is contained in:
@@ -11,6 +11,7 @@ import * as vscode from 'vscode';
|
||||
import { ExtHostWebviewsShape, IMainContext, MainContext, MainThreadWebviewsShape, WebviewPanelHandle, WebviewPanelViewState, WebviewInsetHandle } from './extHost.protocol';
|
||||
import { Disposable } from './extHostTypes';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import * as modes from 'vs/editor/common/modes';
|
||||
|
||||
type IconPath = URI | { light: URI, dark: URI };
|
||||
|
||||
@@ -58,7 +59,7 @@ export class ExtHostWebview implements vscode.Webview {
|
||||
|
||||
public set options(newOptions: vscode.WebviewOptions) {
|
||||
this.assertNotDisposed();
|
||||
this._proxy.$setOptions(this._handle, newOptions);
|
||||
this._proxy.$setOptions(this._handle, convertWebviewOptions(newOptions));
|
||||
this._options = newOptions;
|
||||
}
|
||||
|
||||
@@ -257,7 +258,7 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
||||
};
|
||||
|
||||
const handle = ExtHostWebviews.newHandle();
|
||||
this._proxy.$createWebviewPanel(handle, viewType, title, webviewShowOptions, options, extension.identifier, extension.extensionLocation);
|
||||
this._proxy.$createWebviewPanel(handle, viewType, title, webviewShowOptions, convertWebviewOptions(options), extension.identifier, extension.extensionLocation);
|
||||
|
||||
const webview = new ExtHostWebview(handle, this._proxy, options);
|
||||
const panel = new ExtHostWebviewPanel(handle, this._proxy, viewType, title, viewColumn, options, webview);
|
||||
@@ -325,7 +326,7 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
||||
title: string,
|
||||
state: any,
|
||||
position: EditorViewColumn,
|
||||
options: vscode.WebviewOptions & vscode.WebviewPanelOptions
|
||||
options: modes.IWebviewOptions & modes.IWebviewPanelOptions
|
||||
): Promise<void> {
|
||||
const serializer = this._serializers.get(viewType);
|
||||
if (!serializer) {
|
||||
@@ -342,3 +343,20 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
||||
return this._webviewPanels.get(handle);
|
||||
}
|
||||
}
|
||||
|
||||
function convertWebviewOptions(
|
||||
options: vscode.WebviewPanelOptions & vscode.WebviewOptions
|
||||
): modes.IWebviewOptions {
|
||||
return {
|
||||
...options,
|
||||
portMapping: options.portMapping
|
||||
? options.portMapping.map((x): modes.IWebviewPortMapping => {
|
||||
// Handle old proposed api
|
||||
if ('port' in x) {
|
||||
return { webviewPort: (x as any).port, extensionHostPort: (x as any).resolvedPort };
|
||||
}
|
||||
return { webviewPort: x.webviewPort, extensionHostPort: x.extensionHostPort };
|
||||
})
|
||||
: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user