diff --git a/src/vs/workbench/api/browser/mainThreadCodeInsets.ts b/src/vs/workbench/api/browser/mainThreadCodeInsets.ts index 746d31461f7..18dddc41b8c 100644 --- a/src/vs/workbench/api/browser/mainThreadCodeInsets.ts +++ b/src/vs/workbench/api/browser/mainThreadCodeInsets.ts @@ -11,7 +11,7 @@ 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 { IWebviewService, WebviewElement } from 'vs/workbench/contrib/webview/browser/webview'; +import { IWebviewService, IWebviewElement } from 'vs/workbench/contrib/webview/browser/webview'; import { extHostNamedCustomer } from '../common/extHostCustomers'; // todo@jrieken move these things back into something like contrib/insets @@ -34,7 +34,7 @@ class EditorWebviewZone implements IViewZone { readonly editor: IActiveCodeEditor, readonly line: number, readonly height: number, - readonly webview: WebviewElement, + readonly webview: IWebviewElement, ) { this.domNode = document.createElement('div'); this.domNode.style.zIndex = '10'; // without this, the webview is not interactive diff --git a/src/vs/workbench/api/browser/mainThreadWebviews.ts b/src/vs/workbench/api/browser/mainThreadWebviews.ts index 0e1a4c25efc..0870dcc05d6 100644 --- a/src/vs/workbench/api/browser/mainThreadWebviews.ts +++ b/src/vs/workbench/api/browser/mainThreadWebviews.ts @@ -15,7 +15,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener'; import { IProductService } from 'vs/platform/product/common/productService'; import * as extHostProtocol from 'vs/workbench/api/common/extHost.protocol'; import { serializeWebviewMessage, deserializeWebviewMessage } from 'vs/workbench/api/common/extHostWebviewMessaging'; -import { Webview, WebviewContentOptions, WebviewExtensionDescription, WebviewOverlay } from 'vs/workbench/contrib/webview/browser/webview'; +import { IWebview, WebviewContentOptions, WebviewExtensionDescription, IOverlayWebview } from 'vs/workbench/contrib/webview/browser/webview'; export class MainThreadWebviews extends Disposable implements extHostProtocol.MainThreadWebviewsShape { @@ -29,7 +29,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma private readonly _proxy: extHostProtocol.ExtHostWebviewsShape; - private readonly _webviews = new Map(); + private readonly _webviews = new Map(); constructor( context: extHostProtocol.IExtHostContext, @@ -41,7 +41,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma this._proxy = context.getProxy(extHostProtocol.ExtHostContext.ExtHostWebviews); } - public addWebview(handle: extHostProtocol.WebviewHandle, webview: WebviewOverlay, options: { serializeBuffersForPostMessage: boolean }): void { + public addWebview(handle: extHostProtocol.WebviewHandle, webview: IOverlayWebview, options: { serializeBuffersForPostMessage: boolean }): void { if (this._webviews.has(handle)) { throw new Error('Webview already registered'); } @@ -67,7 +67,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma return true; } - private hookupWebviewEventDelegate(handle: extHostProtocol.WebviewHandle, webview: WebviewOverlay, options: { serializeBuffersForPostMessage: boolean }) { + private hookupWebviewEventDelegate(handle: extHostProtocol.WebviewHandle, webview: IOverlayWebview, options: { serializeBuffersForPostMessage: boolean }) { const disposables = new DisposableStore(); disposables.add(webview.onDidClickLink((uri) => this.onDidClickLink(handle, uri))); @@ -92,7 +92,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma } } - private isSupportedLink(webview: Webview, link: URI): boolean { + private isSupportedLink(webview: IWebview, link: URI): boolean { if (MainThreadWebviews.standardSupportedLinkSchemes.has(link.scheme)) { return true; } @@ -102,7 +102,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma return !!webview.contentOptions.enableCommandUris && link.scheme === Schemas.command; } - private getWebview(handle: extHostProtocol.WebviewHandle): Webview { + private getWebview(handle: extHostProtocol.WebviewHandle): IWebview { const webview = this._webviews.get(handle); if (!webview) { throw new Error(`Unknown webview handle:${handle}`); diff --git a/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts b/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts index afcb2b83d1f..1feb70a01bd 100644 --- a/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts +++ b/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts @@ -20,7 +20,7 @@ import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo'; import { DEFAULT_EDITOR_ASSOCIATION, EditorInputCapabilities, GroupIdentifier, IRevertOptions, ISaveOptions, isEditorInputWithOptionsAndGroup, IUntypedEditorInput, Verbosity } from 'vs/workbench/common/editor'; import { EditorInput } from 'vs/workbench/common/editor/editorInput'; import { ICustomEditorModel, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor'; -import { IWebviewService, WebviewOverlay } from 'vs/workbench/contrib/webview/browser/webview'; +import { IWebviewService, IOverlayWebview } from 'vs/workbench/contrib/webview/browser/webview'; import { IWebviewWorkbenchService, LazilyResolvedWebviewEditorInput } from 'vs/workbench/contrib/webviewPanel/browser/webviewWorkbenchService'; import { IEditorResolverService } from 'vs/workbench/services/editor/common/editorResolverService'; import { IUntitledTextEditorService } from 'vs/workbench/services/untitled/common/untitledTextEditorService'; @@ -66,7 +66,7 @@ export class CustomEditorInput extends LazilyResolvedWebviewEditorInput { resource: URI, viewType: string, id: string, - webview: WebviewOverlay, + webview: IOverlayWebview, options: { startsDirty?: boolean, backupId?: string, untitledDocumentData?: VSBuffer, readonly oldResource?: URI }, @IWebviewWorkbenchService webviewWorkbenchService: IWebviewWorkbenchService, @IInstantiationService private readonly instantiationService: IInstantiationService, diff --git a/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts b/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts index 4ca69589518..e3712271e12 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts @@ -50,7 +50,7 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten import { getDefaultValue } from 'vs/platform/configuration/common/configurationRegistry'; import { isUndefined } from 'vs/base/common/types'; import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService'; -import { IWebviewService, Webview, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED } from 'vs/workbench/contrib/webview/browser/webview'; +import { IWebviewService, IWebview, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED } from 'vs/workbench/contrib/webview/browser/webview'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { generateUuid } from 'vs/base/common/uuid'; import { platform } from 'vs/base/common/process'; @@ -554,11 +554,11 @@ export class ExtensionEditor extends EditorPane { this.activeWebview?.runFindAction(previous); } - public get activeWebview(): Webview | undefined { - if (!this.activeElement || !(this.activeElement as Webview).runFindAction) { + public get activeWebview(): IWebview | undefined { + if (!this.activeElement || !(this.activeElement as IWebview).runFindAction) { return undefined; } - return this.activeElement as Webview; + return this.activeElement as IWebview; } private onNavbarChange(extension: IExtension, { id, focus }: { id: string | null, focus: boolean }, template: IExtensionEditorTemplate): void { diff --git a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts index bd2cef314c1..17f87d1147e 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts @@ -44,7 +44,7 @@ import { CONTEXT_SYNC_ENABLEMENT } from 'vs/workbench/services/userDataSync/comm import { CopyAction, CutAction, PasteAction } from 'vs/editor/contrib/clipboard/clipboard'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { MultiCommand } from 'vs/editor/browser/editorExtensions'; -import { Webview } from 'vs/workbench/contrib/webview/browser/webview'; +import { IWebview } from 'vs/workbench/contrib/webview/browser/webview'; import { ExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/browser/extensionsWorkbenchService'; import { WorkbenchStateContext } from 'vs/workbench/browser/contextkeys'; import { CATEGORIES } from 'vs/workbench/common/actions'; @@ -366,7 +366,7 @@ CommandsRegistry.registerCommand({ } }); -function overrideActionForActiveExtensionEditorWebview(command: MultiCommand | undefined, f: (webview: Webview) => void) { +function overrideActionForActiveExtensionEditorWebview(command: MultiCommand | undefined, f: (webview: IWebview) => void) { command?.addImplementation(105, 'extensions-editor', (accessor) => { const editorService = accessor.get(IEditorService); const editor = editorService.activeEditorPane; diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.ts b/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.ts index 59b0dc8b666..56398f263db 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.ts @@ -24,7 +24,7 @@ import { InputFocusedContextKey } from 'vs/platform/contextkey/common/contextkey import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { RedoCommand, UndoCommand } from 'vs/editor/browser/editorExtensions'; -import { Webview } from 'vs/workbench/contrib/webview/browser/webview'; +import { IWebview } from 'vs/workbench/contrib/webview/browser/webview'; import { CATEGORIES } from 'vs/workbench/common/actions'; import { IOutputService } from 'vs/workbench/contrib/output/common/output'; import { rendererLogChannelId } from 'vs/workbench/contrib/logs/common/logConstants'; @@ -41,7 +41,7 @@ function _log(loggerService: ILogService, str: string) { } } -function getFocusedWebviewDelegate(accessor: ServicesAccessor): Webview | undefined { +function getFocusedWebviewDelegate(accessor: ServicesAccessor): IWebview | undefined { const loggerService = accessor.get(ILogService); const editorService = accessor.get(IEditorService); const editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane); @@ -65,7 +65,7 @@ function getFocusedWebviewDelegate(accessor: ServicesAccessor): Webview | undefi return webview; } -function withWebview(accessor: ServicesAccessor, f: (webviewe: Webview) => void) { +function withWebview(accessor: ServicesAccessor, f: (webviewe: IWebview) => void) { const webview = getFocusedWebviewDelegate(accessor); if (webview) { f(webview); diff --git a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts index 3e35ac261b0..19d614d3908 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts @@ -16,7 +16,7 @@ import { CellViewModel, IModelDecorationsChangeAccessor, INotebookEditorViewStat import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel'; import { CellKind, NotebookCellMetadata, IOrderedMimeType, INotebookRendererInfo, ICellOutput, INotebookCellStatusBarItem, NotebookCellInternalMetadata, NotebookDocumentMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { ICellRange, cellRangesToIndexes, reduceCellRanges } from 'vs/workbench/contrib/notebook/common/notebookRange'; -import { Webview } from 'vs/workbench/contrib/webview/browser/webview'; +import { IWebview } from 'vs/workbench/contrib/webview/browser/webview'; import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel'; import { MenuId } from 'vs/platform/actions/common/actions'; import { IEditorPane } from 'vs/workbench/common/editor'; @@ -430,7 +430,7 @@ export interface INotebookEditor { hasModel(): this is IActiveNotebookEditor; dispose(): void; getDomNode(): HTMLElement; - getInnerWebview(): Webview | undefined; + getInnerWebview(): IWebview | undefined; getSelectionViewModels(): ICellViewModel[]; /** diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts index d06443d7e56..a127c518c2d 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts @@ -58,7 +58,7 @@ import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/no import { CellKind, SelectionStateType } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { ICellRange } from 'vs/workbench/contrib/notebook/common/notebookRange'; import { editorGutterModifiedBackground } from 'vs/workbench/contrib/scm/browser/dirtydiffDecorator'; -import { Webview } from 'vs/workbench/contrib/webview/browser/webview'; +import { IWebview } from 'vs/workbench/contrib/webview/browser/webview'; import { mark } from 'vs/workbench/contrib/notebook/common/notebookPerformance'; import { readFontInfo } from 'vs/editor/browser/config/configuration'; import { INotebookKernelService } from 'vs/workbench/contrib/notebook/common/notebookKernelService'; @@ -1055,7 +1055,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD return this._overflowContainer; } - getInnerWebview(): Webview | undefined { + getInnerWebview(): IWebview | undefined { return this._webview?.webview; } diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts index 1a525a0a4ab..a50277d830a 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts @@ -36,7 +36,7 @@ import { INotebookRendererInfo, RendererMessagingSpec } from 'vs/workbench/contr import { INotebookKernel } from 'vs/workbench/contrib/notebook/common/notebookKernelService'; import { IScopedRendererMessaging } from 'vs/workbench/contrib/notebook/common/notebookRendererMessagingService'; import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService'; -import { IWebviewService, WebviewContentPurpose, WebviewElement } from 'vs/workbench/contrib/webview/browser/webview'; +import { IWebviewService, WebviewContentPurpose, IWebviewElement } from 'vs/workbench/contrib/webview/browser/webview'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { FromWebviewMessage, IAckOutputHeight, IClickedDataUrlMessage, IContentWidgetTopRequest, IControllerPreload, ICreationRequestMessage, IMarkupCellInitialization, ToWebviewMessage } from './webviewMessages'; @@ -60,7 +60,7 @@ export interface INotebookWebviewMessage { } export interface IResolvedBackLayerWebview { - webview: WebviewElement; + webview: IWebviewElement; } /** @@ -87,7 +87,7 @@ export interface INotebookDelegateForWebview { export class BackLayerWebView extends Disposable { element: HTMLElement; - webview: WebviewElement | undefined = undefined; + webview: IWebviewElement | undefined = undefined; insetMapping: Map> = new Map(); readonly markupPreviewMapping = new Map(); private hiddenInsetMapping: Set = new Set(); diff --git a/src/vs/workbench/contrib/webview/browser/dynamicWebviewEditorOverlay.ts b/src/vs/workbench/contrib/webview/browser/overlayWebview.ts similarity index 95% rename from src/vs/workbench/contrib/webview/browser/dynamicWebviewEditorOverlay.ts rename to src/vs/workbench/contrib/webview/browser/overlayWebview.ts index 2999d4df486..3e898e16f14 100644 --- a/src/vs/workbench/contrib/webview/browser/dynamicWebviewEditorOverlay.ts +++ b/src/vs/workbench/contrib/webview/browser/overlayWebview.ts @@ -11,18 +11,18 @@ import { URI } from 'vs/base/common/uri'; import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; import { ILayoutService } from 'vs/platform/layout/browser/layoutService'; -import { IWebviewService, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_ENABLED, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE, Webview, WebviewContentOptions, WebviewElement, WebviewExtensionDescription, WebviewMessageReceivedEvent, WebviewOptions, WebviewOverlay } from 'vs/workbench/contrib/webview/browser/webview'; +import { IWebviewService, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_ENABLED, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE, IWebview, WebviewContentOptions, IWebviewElement, WebviewExtensionDescription, WebviewMessageReceivedEvent, WebviewOptions, IOverlayWebview } from 'vs/workbench/contrib/webview/browser/webview'; /** - * Webview editor overlay that creates and destroys the underlying webview as needed. + * Webview that is absolutely positioned over another element and that can creates and destroys an underlying webview as needed. */ -export class DynamicWebviewEditorOverlay extends Disposable implements WebviewOverlay { +export class OverlayWebview extends Disposable implements IOverlayWebview { private readonly _onDidWheel = this._register(new Emitter()); public readonly onDidWheel = this._onDidWheel.event; private readonly _pendingMessages = new Set<{ readonly message: any, readonly transfer?: readonly ArrayBuffer[] }>(); - private readonly _webview = this._register(new MutableDisposable()); + private readonly _webview = this._register(new MutableDisposable()); private readonly _webviewEvents = this._register(new DisposableStore()); private _html: string = ''; @@ -299,7 +299,7 @@ export class DynamicWebviewEditorOverlay extends Disposable implements WebviewOv runFindAction(previous: boolean): void { this._webview.value?.runFindAction(previous); } - private withWebview(f: (webview: Webview) => void): void { + private withWebview(f: (webview: IWebview) => void): void { if (this._webview.value) { f(this._webview.value); } diff --git a/src/vs/workbench/contrib/webview/browser/webview.contribution.ts b/src/vs/workbench/contrib/webview/browser/webview.contribution.ts index 1f6d293e4bb..5997948941c 100644 --- a/src/vs/workbench/contrib/webview/browser/webview.contribution.ts +++ b/src/vs/workbench/contrib/webview/browser/webview.contribution.ts @@ -7,14 +7,14 @@ import { MultiCommand, RedoCommand, SelectAllCommand, UndoCommand } from 'vs/edi import { CopyAction, CutAction, PasteAction } from 'vs/editor/contrib/clipboard/clipboard'; import * as nls from 'vs/nls'; import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions'; -import { IWebviewService, Webview } from 'vs/workbench/contrib/webview/browser/webview'; +import { IWebviewService, IWebview } from 'vs/workbench/contrib/webview/browser/webview'; import { WebviewInput } from 'vs/workbench/contrib/webviewPanel/browser/webviewEditorInput'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; const PRIORITY = 100; -function overrideCommandForWebview(command: MultiCommand | undefined, f: (webview: Webview) => void) { +function overrideCommandForWebview(command: MultiCommand | undefined, f: (webview: IWebview) => void) { command?.addImplementation(PRIORITY, 'webview', accessor => { const webviewService = accessor.get(IWebviewService); const webview = webviewService.activeWebview; diff --git a/src/vs/workbench/contrib/webview/browser/webview.ts b/src/vs/workbench/contrib/webview/browser/webview.ts index ce89ff2df1a..26efb1ed53e 100644 --- a/src/vs/workbench/contrib/webview/browser/webview.ts +++ b/src/vs/workbench/contrib/webview/browser/webview.ts @@ -30,17 +30,17 @@ export interface IWebviewService { /** * The currently focused webview. */ - readonly activeWebview: Webview | undefined; + readonly activeWebview: IWebview | undefined; /** * All webviews. */ - readonly webviews: Iterable; + readonly webviews: Iterable; /** * Fired when the currently focused webview changes. */ - readonly onDidChangeActiveWebview: Event; + readonly onDidChangeActiveWebview: Event; /** * Create a basic webview dom element. @@ -50,7 +50,7 @@ export interface IWebviewService { options: WebviewOptions, contentOptions: WebviewContentOptions, extension: WebviewExtensionDescription | undefined, - ): WebviewElement; + ): IWebviewElement; /** * Create a lazily created webview element that is overlaid on top of another element. @@ -63,7 +63,7 @@ export interface IWebviewService { options: WebviewOptions, contentOptions: WebviewContentOptions, extension: WebviewExtensionDescription | undefined, - ): WebviewOverlay; + ): IOverlayWebview; } export const enum WebviewContentPurpose { @@ -119,7 +119,7 @@ export interface WebviewMessageReceivedEvent { readonly transfer?: readonly ArrayBuffer[]; } -export interface Webview extends IDisposable { +export interface IWebview extends IDisposable { readonly id: string; @@ -169,12 +169,12 @@ export interface Webview extends IDisposable { /** * Basic webview rendered directly in the dom */ -export interface WebviewElement extends Webview { +export interface IWebviewElement extends IWebview { /** * Append the webview to a HTML element. * * Note that the webview content will be destroyed if any part of the parent hierarchy - * changes. You can avoid this by using a {@link WebviewOverlay} instead. + * changes. You can avoid this by using a {@link IOverlayWebview} instead. * * @param parent Element to append the webview to. */ @@ -182,15 +182,15 @@ export interface WebviewElement extends Webview { } /** - * Lazily created {@link Webview} that is absolutely positioned over another element. + * Lazily created {@link IWebview} that is absolutely positioned over another element. * * Absolute positioning lets us avoid having the webview be re-parented, which would destroy the * webview's content. * * Note that the underlying webview owned by a `WebviewOverlay` can be dynamically created - * and destroyed depending on who has {@link WebviewOverlay.claim claimed} or {@link WebviewOverlay.release released} it. + * and destroyed depending on who has {@link IOverlayWebview.claim claimed} or {@link IOverlayWebview.release released} it. */ -export interface WebviewOverlay extends Webview { +export interface IOverlayWebview extends IWebview { /** * The HTML element that holds the webview. */ @@ -204,7 +204,7 @@ export interface WebviewOverlay extends Webview { * This will create the underlying webview element. * * @param claimant Identifier for the object claiming the webview. - * This must match the `claimant` passed to {@link WebviewOverlay.release}. + * This must match the `claimant` passed to {@link IOverlayWebview.release}. */ claim(claimant: any, scopedContextKeyService: IContextKeyService | undefined): void; @@ -215,7 +215,7 @@ export interface WebviewOverlay extends Webview { * cause the underlying webview element to be destoryed. * * @param claimant Identifier for the object releasing its claim on the webview. - * This must match the `claimant` passed to {@link WebviewOverlay.claim}. + * This must match the `claimant` passed to {@link IOverlayWebview.claim}. */ release(claimant: any): void; diff --git a/src/vs/workbench/contrib/webview/browser/webviewElement.ts b/src/vs/workbench/contrib/webview/browser/webviewElement.ts index 43b853460c6..b645e966772 100644 --- a/src/vs/workbench/contrib/webview/browser/webviewElement.ts +++ b/src/vs/workbench/contrib/webview/browser/webviewElement.ts @@ -32,7 +32,7 @@ import { WebviewPortMappingManager } from 'vs/platform/webview/common/webviewPor import { asWebviewUri, decodeAuthority, webviewGenericCspSource, webviewRootResourceAuthority } from 'vs/workbench/api/common/shared/webview'; import { loadLocalResource, WebviewResourceResponse } from 'vs/workbench/contrib/webview/browser/resourceLoading'; import { WebviewThemeDataProvider } from 'vs/workbench/contrib/webview/browser/themeing'; -import { areWebviewContentOptionsEqual, Webview, WebviewContentOptions, WebviewExtensionDescription, WebviewMessageReceivedEvent, WebviewOptions } from 'vs/workbench/contrib/webview/browser/webview'; +import { areWebviewContentOptionsEqual, IWebview, WebviewContentOptions, WebviewExtensionDescription, WebviewMessageReceivedEvent, WebviewOptions } from 'vs/workbench/contrib/webview/browser/webview'; import { WebviewFindDelegate, WebviewFindWidget } from 'vs/workbench/contrib/webview/browser/webviewFindWidget'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; @@ -91,7 +91,7 @@ namespace WebviewState { export type State = typeof Ready | Initializing; } -export class IFrameWebview extends Disposable implements Webview, WebviewFindDelegate { +export class WebviewElement extends Disposable implements IWebview, WebviewFindDelegate { protected get platform(): string { return 'browser'; } diff --git a/src/vs/workbench/contrib/webview/browser/webviewService.ts b/src/vs/workbench/contrib/webview/browser/webviewService.ts index d99b5796ae6..ef902f5d5e8 100644 --- a/src/vs/workbench/contrib/webview/browser/webviewService.ts +++ b/src/vs/workbench/contrib/webview/browser/webviewService.ts @@ -7,9 +7,9 @@ import { Emitter } from 'vs/base/common/event'; import { Disposable } from 'vs/base/common/lifecycle'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { WebviewThemeDataProvider } from 'vs/workbench/contrib/webview/browser/themeing'; -import { IWebviewService, Webview, WebviewContentOptions, WebviewElement, WebviewExtensionDescription, WebviewOptions, WebviewOverlay } from 'vs/workbench/contrib/webview/browser/webview'; -import { IFrameWebview } from 'vs/workbench/contrib/webview/browser/webviewElement'; -import { DynamicWebviewEditorOverlay } from './dynamicWebviewEditorOverlay'; +import { IWebviewService, IWebview, WebviewContentOptions, IWebviewElement, WebviewExtensionDescription, WebviewOptions, IOverlayWebview } from 'vs/workbench/contrib/webview/browser/webview'; +import { WebviewElement } from 'vs/workbench/contrib/webview/browser/webviewElement'; +import { OverlayWebview } from './overlayWebview'; export class WebviewService extends Disposable implements IWebviewService { declare readonly _serviceBrand: undefined; @@ -23,24 +23,24 @@ export class WebviewService extends Disposable implements IWebviewService { this._webviewThemeDataProvider = this._instantiationService.createInstance(WebviewThemeDataProvider); } - private _activeWebview?: Webview; + private _activeWebview?: IWebview; public get activeWebview() { return this._activeWebview; } - private updateActiveWebview(value: Webview | undefined) { + private updateActiveWebview(value: IWebview | undefined) { if (value !== this._activeWebview) { this._activeWebview = value; this._onDidChangeActiveWebview.fire(value); } } - private _webviews = new Set(); + private _webviews = new Set(); - public get webviews(): Iterable { + public get webviews(): Iterable { return this._webviews.values(); } - private readonly _onDidChangeActiveWebview = this._register(new Emitter()); + private readonly _onDidChangeActiveWebview = this._register(new Emitter()); public readonly onDidChangeActiveWebview = this._onDidChangeActiveWebview.event; createWebviewElement( @@ -48,8 +48,8 @@ export class WebviewService extends Disposable implements IWebviewService { options: WebviewOptions, contentOptions: WebviewContentOptions, extension: WebviewExtensionDescription | undefined, - ): WebviewElement { - const webview = this._instantiationService.createInstance(IFrameWebview, id, options, contentOptions, extension, this._webviewThemeDataProvider); + ): IWebviewElement { + const webview = this._instantiationService.createInstance(WebviewElement, id, options, contentOptions, extension, this._webviewThemeDataProvider); this.registerNewWebview(webview); return webview; } @@ -59,13 +59,13 @@ export class WebviewService extends Disposable implements IWebviewService { options: WebviewOptions, contentOptions: WebviewContentOptions, extension: WebviewExtensionDescription | undefined, - ): WebviewOverlay { - const webview = this._instantiationService.createInstance(DynamicWebviewEditorOverlay, id, options, contentOptions, extension); + ): IOverlayWebview { + const webview = this._instantiationService.createInstance(OverlayWebview, id, options, contentOptions, extension); this.registerNewWebview(webview); return webview; } - protected registerNewWebview(webview: Webview) { + protected registerNewWebview(webview: IWebview) { this._webviews.add(webview); webview.onDidFocus(() => { diff --git a/src/vs/workbench/contrib/webview/browser/webviewWindowDragMonitor.ts b/src/vs/workbench/contrib/webview/browser/webviewWindowDragMonitor.ts index 3bbc9e85798..e7afcb8cd5c 100644 --- a/src/vs/workbench/contrib/webview/browser/webviewWindowDragMonitor.ts +++ b/src/vs/workbench/contrib/webview/browser/webviewWindowDragMonitor.ts @@ -5,7 +5,7 @@ import * as DOM from 'vs/base/browser/dom'; import { Disposable } from 'vs/base/common/lifecycle'; -import { Webview } from 'vs/workbench/contrib/webview/browser/webview'; +import { IWebview } from 'vs/workbench/contrib/webview/browser/webview'; /** * Allows webviews to monitor when an element in the VS Code editor is being dragged/dropped. @@ -14,7 +14,7 @@ import { Webview } from 'vs/workbench/contrib/webview/browser/webview'; * event so it can handle editor element drag drop. */ export class WebviewWindowDragMonitor extends Disposable { - constructor(getWebview: () => Webview | undefined) { + constructor(getWebview: () => IWebview | undefined) { super(); this._register(DOM.addDisposableListener(window, DOM.EventType.DRAG_START, () => { diff --git a/src/vs/workbench/contrib/webview/electron-sandbox/iframeWebviewElement.ts b/src/vs/workbench/contrib/webview/electron-sandbox/webviewElement.ts similarity index 97% rename from src/vs/workbench/contrib/webview/electron-sandbox/iframeWebviewElement.ts rename to src/vs/workbench/contrib/webview/electron-sandbox/webviewElement.ts index 4ad6caa6d4f..d1318e247ae 100644 --- a/src/vs/workbench/contrib/webview/electron-sandbox/iframeWebviewElement.ts +++ b/src/vs/workbench/contrib/webview/electron-sandbox/webviewElement.ts @@ -21,14 +21,14 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { FindInFrameOptions, IWebviewManagerService } from 'vs/platform/webview/common/webviewManagerService'; import { WebviewThemeDataProvider } from 'vs/workbench/contrib/webview/browser/themeing'; import { WebviewContentOptions, WebviewExtensionDescription, WebviewOptions } from 'vs/workbench/contrib/webview/browser/webview'; -import { IFrameWebview, WebviewMessageChannels } from 'vs/workbench/contrib/webview/browser/webviewElement'; +import { WebviewElement, WebviewMessageChannels } from 'vs/workbench/contrib/webview/browser/webviewElement'; import { WindowIgnoreMenuShortcutsManager } from 'vs/workbench/contrib/webview/electron-sandbox/windowIgnoreMenuShortcutsManager'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; /** * Webview backed by an iframe but that uses Electron APIs to power the webview. */ -export class ElectronIframeWebview extends IFrameWebview { +export class ElectronWebviewElement extends WebviewElement { private readonly _webviewKeyboardHandler: WindowIgnoreMenuShortcutsManager; diff --git a/src/vs/workbench/contrib/webview/electron-sandbox/webviewService.ts b/src/vs/workbench/contrib/webview/electron-sandbox/webviewService.ts index ebd8b9c62e6..c63c3a65675 100644 --- a/src/vs/workbench/contrib/webview/electron-sandbox/webviewService.ts +++ b/src/vs/workbench/contrib/webview/electron-sandbox/webviewService.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { WebviewContentOptions, WebviewElement, WebviewExtensionDescription, WebviewOptions } from 'vs/workbench/contrib/webview/browser/webview'; +import { IWebviewElement, WebviewContentOptions, WebviewExtensionDescription, WebviewOptions } from 'vs/workbench/contrib/webview/browser/webview'; import { WebviewService } from 'vs/workbench/contrib/webview/browser/webviewService'; -import { ElectronIframeWebview } from 'vs/workbench/contrib/webview/electron-sandbox/iframeWebviewElement'; +import { ElectronWebviewElement } from 'vs/workbench/contrib/webview/electron-sandbox/webviewElement'; export class ElectronWebviewService extends WebviewService { @@ -14,8 +14,8 @@ export class ElectronWebviewService extends WebviewService { options: WebviewOptions, contentOptions: WebviewContentOptions, extension: WebviewExtensionDescription | undefined, - ): WebviewElement { - const webview = this._instantiationService.createInstance(ElectronIframeWebview, id, options, contentOptions, extension, this._webviewThemeDataProvider); + ): IWebviewElement { + const webview = this._instantiationService.createInstance(ElectronWebviewElement, id, options, contentOptions, extension, this._webviewThemeDataProvider); this.registerNewWebview(webview); return webview; } diff --git a/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.ts b/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.ts index eb3d434fa27..95a869f9ffa 100644 --- a/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.ts +++ b/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.ts @@ -11,7 +11,7 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { CATEGORIES } from 'vs/workbench/common/actions'; -import { IWebviewService, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_ENABLED, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE, Webview } from 'vs/workbench/contrib/webview/browser/webview'; +import { IWebviewService, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_ENABLED, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE, IWebview } from 'vs/workbench/contrib/webview/browser/webview'; import { WebviewEditor } from 'vs/workbench/contrib/webviewPanel/browser/webviewEditor'; import { WebviewInput } from 'vs/workbench/contrib/webviewPanel/browser/webviewEditorInput'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; @@ -125,7 +125,7 @@ export class ReloadWebviewAction extends Action2 { } } -export function getActiveWebviewEditor(accessor: ServicesAccessor): Webview | undefined { +export function getActiveWebviewEditor(accessor: ServicesAccessor): IWebview | undefined { const editorService = accessor.get(IEditorService); const activeEditor = editorService.activeEditor; return activeEditor instanceof WebviewInput ? activeEditor.webview : undefined; diff --git a/src/vs/workbench/contrib/webviewPanel/browser/webviewEditor.ts b/src/vs/workbench/contrib/webviewPanel/browser/webviewEditor.ts index d4007063b03..db5f17a67a9 100644 --- a/src/vs/workbench/contrib/webviewPanel/browser/webviewEditor.ts +++ b/src/vs/workbench/contrib/webviewPanel/browser/webviewEditor.ts @@ -17,7 +17,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService'; import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane'; import { IEditorOpenContext } from 'vs/workbench/common/editor'; import { EditorInput } from 'vs/workbench/common/editor/editorInput'; -import { WebviewOverlay } from 'vs/workbench/contrib/webview/browser/webview'; +import { IOverlayWebview } from 'vs/workbench/contrib/webview/browser/webview'; import { WebviewWindowDragMonitor } from 'vs/workbench/contrib/webview/browser/webviewWindowDragMonitor'; import { WebviewInput } from 'vs/workbench/contrib/webviewPanel/browser/webviewEditorInput'; import { IEditorDropService } from 'vs/workbench/services/editor/browser/editorDropService'; @@ -56,7 +56,7 @@ export class WebviewEditor extends EditorPane { super(WebviewEditor.ID, telemetryService, themeService, storageService); } - private get webview(): WebviewOverlay | undefined { + private get webview(): IOverlayWebview | undefined { return this.input instanceof WebviewInput ? this.input.webview : undefined; } @@ -175,13 +175,13 @@ export class WebviewEditor extends EditorPane { this._webviewVisibleDisposables.add(this.trackFocus(input.webview)); } - private synchronizeWebviewContainerDimensions(webview: WebviewOverlay, dimension?: DOM.Dimension) { + private synchronizeWebviewContainerDimensions(webview: IOverlayWebview, dimension?: DOM.Dimension) { if (this._element) { webview.layoutWebviewOverElement(this._element.parentElement!, dimension); } } - private trackFocus(webview: WebviewOverlay): IDisposable { + private trackFocus(webview: IOverlayWebview): IDisposable { const store = new DisposableStore(); // Track focus in webview content diff --git a/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInput.ts b/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInput.ts index ea9ed89a6b1..1caa0e68f25 100644 --- a/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInput.ts +++ b/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInput.ts @@ -7,7 +7,7 @@ import { Schemas } from 'vs/base/common/network'; import { URI } from 'vs/base/common/uri'; import { EditorInputCapabilities, GroupIdentifier, IUntypedEditorInput, Verbosity } from 'vs/workbench/common/editor'; import { EditorInput } from 'vs/workbench/common/editor/editorInput'; -import { WebviewOverlay } from 'vs/workbench/contrib/webview/browser/webview'; +import { IOverlayWebview } from 'vs/workbench/contrib/webview/browser/webview'; import { WebviewIconManager, WebviewIcons } from 'vs/workbench/contrib/webviewPanel/browser/webviewIconManager'; export class WebviewInput extends EditorInput { @@ -30,7 +30,7 @@ export class WebviewInput extends EditorInput { private _iconPath?: WebviewIcons; private _group?: GroupIdentifier; - private _webview: WebviewOverlay; + private _webview: IOverlayWebview; private _hasTransfered = false; @@ -45,7 +45,7 @@ export class WebviewInput extends EditorInput { public readonly id: string, public readonly viewType: string, name: string, - webview: WebviewOverlay, + webview: IOverlayWebview, private readonly _iconManager: WebviewIconManager, ) { super(); @@ -79,7 +79,7 @@ export class WebviewInput extends EditorInput { this._onDidChangeLabel.fire(); } - public get webview(): WebviewOverlay { + public get webview(): IOverlayWebview { return this._webview; } diff --git a/src/vs/workbench/contrib/webviewPanel/browser/webviewWorkbenchService.ts b/src/vs/workbench/contrib/webviewPanel/browser/webviewWorkbenchService.ts index cb0d05bbbaa..28657c3f0a6 100644 --- a/src/vs/workbench/contrib/webviewPanel/browser/webviewWorkbenchService.ts +++ b/src/vs/workbench/contrib/webviewPanel/browser/webviewWorkbenchService.ts @@ -15,7 +15,7 @@ import { createDecorator, IInstantiationService } from 'vs/platform/instantiatio import { GroupIdentifier } from 'vs/workbench/common/editor'; import { EditorInput } from 'vs/workbench/common/editor/editorInput'; import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput'; -import { IWebviewService, WebviewContentOptions, WebviewExtensionDescription, WebviewOptions, WebviewOverlay } from 'vs/workbench/contrib/webview/browser/webview'; +import { IWebviewService, WebviewContentOptions, WebviewExtensionDescription, WebviewOptions, IOverlayWebview } from 'vs/workbench/contrib/webview/browser/webview'; import { WebviewIconManager, WebviewIcons } from 'vs/workbench/contrib/webviewPanel/browser/webviewIconManager'; import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { ACTIVE_GROUP_TYPE, IEditorService, SIDE_GROUP_TYPE } from 'vs/workbench/services/editor/common/editorService'; @@ -102,7 +102,7 @@ export class LazilyResolvedWebviewEditorInput extends WebviewInput { id: string, viewType: string, name: string, - webview: WebviewOverlay, + webview: IOverlayWebview, @IWebviewWorkbenchService private readonly _webviewWorkbenchService: IWebviewWorkbenchService, ) { super(id, viewType, name, webview, _webviewWorkbenchService.iconManager); diff --git a/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.ts b/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.ts index 5e0c19d8d93..b381d279bd9 100644 --- a/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.ts +++ b/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.ts @@ -22,7 +22,7 @@ import { ViewPane } from 'vs/workbench/browser/parts/views/viewPane'; import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet'; import { Memento, MementoObject } from 'vs/workbench/common/memento'; import { IViewDescriptorService, IViewsService } from 'vs/workbench/common/views'; -import { IWebviewService, WebviewContentPurpose, WebviewOverlay } from 'vs/workbench/contrib/webview/browser/webview'; +import { IOverlayWebview, IWebviewService, WebviewContentPurpose } from 'vs/workbench/contrib/webview/browser/webview'; import { WebviewWindowDragMonitor } from 'vs/workbench/contrib/webview/browser/webviewWindowDragMonitor'; import { IWebviewViewService, WebviewView } from 'vs/workbench/contrib/webviewView/browser/webviewViewService'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; @@ -35,7 +35,7 @@ const storageKeys = { export class WebviewViewPane extends ViewPane { - private readonly _webview = this._register(new MutableDisposable()); + private readonly _webview = this._register(new MutableDisposable()); private readonly _webviewDisposables = this._register(new DisposableStore()); private _activated = false; diff --git a/src/vs/workbench/contrib/webviewView/browser/webviewViewService.ts b/src/vs/workbench/contrib/webviewView/browser/webviewViewService.ts index 663e359f7cf..268e96fe4e1 100644 --- a/src/vs/workbench/contrib/webviewView/browser/webviewViewService.ts +++ b/src/vs/workbench/contrib/webviewView/browser/webviewViewService.ts @@ -7,7 +7,7 @@ import { CancellationToken } from 'vs/base/common/cancellation'; import { Emitter, Event } from 'vs/base/common/event'; import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; -import { WebviewOverlay } from 'vs/workbench/contrib/webview/browser/webview'; +import { IOverlayWebview } from 'vs/workbench/contrib/webview/browser/webview'; export const IWebviewViewService = createDecorator('webviewViewService'); @@ -15,7 +15,7 @@ export interface WebviewView { title?: string; description?: string; - readonly webview: WebviewOverlay; + readonly webview: IOverlayWebview; readonly onDidChangeVisibility: Event; readonly onDispose: Event;