From 6902a65a769b2a5c1dbb8b87f26622e75d6ecb35 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 9 Nov 2021 16:47:00 -0800 Subject: [PATCH] Align ext host name with internal name --- .../api/browser/mainThreadCodeInsets.ts | 6 +++--- .../api/browser/mainThreadWebviewPanels.ts | 2 +- .../api/browser/mainThreadWebviews.ts | 4 ++-- .../workbench/api/common/extHost.protocol.ts | 18 +++++++++--------- .../api/common/extHostCustomEditors.ts | 2 +- src/vs/workbench/api/common/extHostWebview.ts | 6 +++--- .../api/common/extHostWebviewPanels.ts | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadCodeInsets.ts b/src/vs/workbench/api/browser/mainThreadCodeInsets.ts index 18dddc41b8c..96a88b5c886 100644 --- a/src/vs/workbench/api/browser/mainThreadCodeInsets.ts +++ b/src/vs/workbench/api/browser/mainThreadCodeInsets.ts @@ -10,7 +10,7 @@ import { IActiveCodeEditor, IViewZone } from 'vs/editor/browser/editorBrowser'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; import { reviveWebviewContentOptions } from 'vs/workbench/api/browser/mainThreadWebviews'; -import { ExtHostContext, ExtHostEditorInsetsShape, IExtHostContext, IWebviewOptions, MainContext, MainThreadEditorInsetsShape } from 'vs/workbench/api/common/extHost.protocol'; +import { ExtHostContext, ExtHostEditorInsetsShape, IExtHostContext, IWebviewContentOptions, MainContext, MainThreadEditorInsetsShape } from 'vs/workbench/api/common/extHost.protocol'; import { IWebviewService, IWebviewElement } from 'vs/workbench/contrib/webview/browser/webview'; import { extHostNamedCustomer } from '../common/extHostCustomers'; @@ -70,7 +70,7 @@ export class MainThreadEditorInsets implements MainThreadEditorInsetsShape { this._disposables.dispose(); } - async $createEditorInset(handle: number, id: string, uri: UriComponents, line: number, height: number, options: IWebviewOptions, extensionId: ExtensionIdentifier, extensionLocation: UriComponents): Promise { + async $createEditorInset(handle: number, id: string, uri: UriComponents, line: number, height: number, options: IWebviewContentOptions, extensionId: ExtensionIdentifier, extensionLocation: UriComponents): Promise { let editor: IActiveCodeEditor | undefined; id = id.substr(0, id.indexOf(',')); //todo@jrieken HACK @@ -121,7 +121,7 @@ export class MainThreadEditorInsets implements MainThreadEditorInsetsShape { inset.webview.html = value; } - $setOptions(handle: number, options: IWebviewOptions): void { + $setOptions(handle: number, options: IWebviewContentOptions): void { const inset = this.getInset(handle); inset.webview.contentOptions = reviveWebviewContentOptions(options); } diff --git a/src/vs/workbench/api/browser/mainThreadWebviewPanels.ts b/src/vs/workbench/api/browser/mainThreadWebviewPanels.ts index 1aad68ab99a..0d84f48d862 100644 --- a/src/vs/workbench/api/browser/mainThreadWebviewPanels.ts +++ b/src/vs/workbench/api/browser/mainThreadWebviewPanels.ts @@ -153,7 +153,7 @@ export class MainThreadWebviewPanels extends Disposable implements extHostProtoc viewType: string, initData: { title: string; - webviewOptions: extHostProtocol.IWebviewOptions; + webviewOptions: extHostProtocol.IWebviewContentOptions; panelOptions: extHostProtocol.IWebviewPanelOptions; serializeBuffersForPostMessage: boolean; }, diff --git a/src/vs/workbench/api/browser/mainThreadWebviews.ts b/src/vs/workbench/api/browser/mainThreadWebviews.ts index 0870dcc05d6..b561927365c 100644 --- a/src/vs/workbench/api/browser/mainThreadWebviews.ts +++ b/src/vs/workbench/api/browser/mainThreadWebviews.ts @@ -55,7 +55,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma webview.html = value; } - public $setOptions(handle: extHostProtocol.WebviewHandle, options: extHostProtocol.IWebviewOptions): void { + public $setOptions(handle: extHostProtocol.WebviewHandle, options: extHostProtocol.IWebviewContentOptions): void { const webview = this.getWebview(handle); webview.contentOptions = reviveWebviewContentOptions(options); } @@ -126,7 +126,7 @@ export function reviveWebviewExtension(extensionData: extHostProtocol.WebviewExt return { id: extensionData.id, location: URI.revive(extensionData.location) }; } -export function reviveWebviewContentOptions(webviewOptions: extHostProtocol.IWebviewOptions): WebviewContentOptions { +export function reviveWebviewContentOptions(webviewOptions: extHostProtocol.IWebviewContentOptions): WebviewContentOptions { return { allowScripts: webviewOptions.enableScripts, allowForms: webviewOptions.enableForms, diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 2291bc2eea0..d98c30e40b4 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -618,11 +618,11 @@ export interface MainThreadTelemetryShape extends IDisposable { } export interface MainThreadEditorInsetsShape extends IDisposable { - $createEditorInset(handle: number, id: string, uri: UriComponents, line: number, height: number, options: IWebviewOptions, extensionId: ExtensionIdentifier, extensionLocation: UriComponents): Promise; + $createEditorInset(handle: number, id: string, uri: UriComponents, line: number, height: number, options: IWebviewContentOptions, extensionId: ExtensionIdentifier, extensionLocation: UriComponents): Promise; $disposeEditorInset(handle: number): void; $setHtml(handle: number, value: string): void; - $setOptions(handle: number, options: IWebviewOptions): void; + $setOptions(handle: number, options: IWebviewContentOptions): void; $postMessage(handle: number, value: any): Promise; } @@ -681,12 +681,12 @@ export interface IWebviewPortMapping { readonly extensionHostPort: number; } -export interface IWebviewOptions { +export interface IWebviewContentOptions { readonly enableScripts?: boolean; readonly enableForms?: boolean; readonly enableCommandUris?: boolean; - readonly localResourceRoots?: ReadonlyArray; - readonly portMapping?: ReadonlyArray; + readonly localResourceRoots?: readonly UriComponents[]; + readonly portMapping?: readonly IWebviewPortMapping[]; } export interface IWebviewPanelOptions { @@ -729,7 +729,7 @@ export interface WebviewMessageArrayBufferReference { export interface MainThreadWebviewsShape extends IDisposable { $setHtml(handle: WebviewHandle, value: string): void; - $setOptions(handle: WebviewHandle, options: IWebviewOptions): void; + $setOptions(handle: WebviewHandle, options: IWebviewContentOptions): void; $postMessage(handle: WebviewHandle, value: string, ...buffers: VSBuffer[]): Promise } @@ -740,7 +740,7 @@ export interface MainThreadWebviewPanelsShape extends IDisposable { viewType: string, initData: { title: string; - webviewOptions: IWebviewOptions; + webviewOptions: IWebviewContentOptions; panelOptions: IWebviewPanelOptions; serializeBuffersForPostMessage: boolean; }, @@ -796,7 +796,7 @@ export interface ExtHostWebviewPanelsShape { initData: { title: string; state: any; - webviewOptions: IWebviewOptions; + webviewOptions: IWebviewContentOptions; panelOptions: IWebviewPanelOptions; }, position: EditorGroupColumn, @@ -810,7 +810,7 @@ export interface ExtHostCustomEditorsShape { viewType: string, initData: { title: string; - webviewOptions: IWebviewOptions; + webviewOptions: IWebviewContentOptions; panelOptions: IWebviewPanelOptions; }, position: EditorGroupColumn, diff --git a/src/vs/workbench/api/common/extHostCustomEditors.ts b/src/vs/workbench/api/common/extHostCustomEditors.ts index 35eb01c390c..5f9a06d01de 100644 --- a/src/vs/workbench/api/common/extHostCustomEditors.ts +++ b/src/vs/workbench/api/common/extHostCustomEditors.ts @@ -253,7 +253,7 @@ export class ExtHostCustomEditors implements extHostProtocol.ExtHostCustomEditor viewType: string, initData: { title: string; - webviewOptions: extHostProtocol.IWebviewOptions; + webviewOptions: extHostProtocol.IWebviewContentOptions; panelOptions: extHostProtocol.IWebviewPanelOptions; }, position: EditorGroupColumn, diff --git a/src/vs/workbench/api/common/extHostWebview.ts b/src/vs/workbench/api/common/extHostWebview.ts index d472ed4414d..2eb67a7bf10 100644 --- a/src/vs/workbench/api/common/extHostWebview.ts +++ b/src/vs/workbench/api/common/extHostWebview.ts @@ -176,7 +176,7 @@ export class ExtHostWebviews implements extHostProtocol.ExtHostWebviewsShape { this._logService.warn(`${extensionId} created a webview without a content security policy: https://aka.ms/vscode-webview-missing-csp`); } - public createNewWebview(handle: string, options: extHostProtocol.IWebviewOptions, extension: IExtensionDescription): ExtHostWebview { + public createNewWebview(handle: string, options: extHostProtocol.IWebviewContentOptions, extension: IExtensionDescription): ExtHostWebview { const webview = new ExtHostWebview(handle, this._webviewProxy, reviveOptions(options), this.initData, this.workspace, extension, this._deprecationService); this._webviews.set(handle, webview); @@ -202,7 +202,7 @@ export function serializeWebviewOptions( extension: IExtensionDescription, workspace: IExtHostWorkspace | undefined, options: vscode.WebviewOptions, -): extHostProtocol.IWebviewOptions { +): extHostProtocol.IWebviewContentOptions { return { enableCommandUris: options.enableCommandUris, enableScripts: options.enableScripts, @@ -212,7 +212,7 @@ export function serializeWebviewOptions( }; } -export function reviveOptions(options: extHostProtocol.IWebviewOptions): vscode.WebviewOptions { +export function reviveOptions(options: extHostProtocol.IWebviewContentOptions): vscode.WebviewOptions { return { enableCommandUris: options.enableCommandUris, enableScripts: options.enableScripts, diff --git a/src/vs/workbench/api/common/extHostWebviewPanels.ts b/src/vs/workbench/api/common/extHostWebviewPanels.ts index c76c364c392..188bda392c1 100644 --- a/src/vs/workbench/api/common/extHostWebviewPanels.ts +++ b/src/vs/workbench/api/common/extHostWebviewPanels.ts @@ -281,7 +281,7 @@ export class ExtHostWebviewPanels implements extHostProtocol.ExtHostWebviewPanel initData: { title: string; state: any; - webviewOptions: extHostProtocol.IWebviewOptions; + webviewOptions: extHostProtocol.IWebviewContentOptions; panelOptions: extHostProtocol.IWebviewPanelOptions; }, position: EditorGroupColumn