Skip to content

Commit 08ef40b

Browse files
committed
Clairify webview names
- Better mark interfaces using `I` - Don't use `iframe` since all webviews now use iframes - WebviewOverlay -> OverlayWebview
1 parent 8e3bfab commit 08ef40b

23 files changed

+85
-85
lines changed

src/vs/workbench/api/browser/mainThreadCodeInsets.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService
1111
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
1212
import { reviveWebviewContentOptions } from 'vs/workbench/api/browser/mainThreadWebviews';
1313
import { ExtHostContext, ExtHostEditorInsetsShape, IExtHostContext, IWebviewOptions, MainContext, MainThreadEditorInsetsShape } from 'vs/workbench/api/common/extHost.protocol';
14-
import { IWebviewService, WebviewElement } from 'vs/workbench/contrib/webview/browser/webview';
14+
import { IWebviewService, IWebviewElement } from 'vs/workbench/contrib/webview/browser/webview';
1515
import { extHostNamedCustomer } from '../common/extHostCustomers';
1616

1717
// todo@jrieken move these things back into something like contrib/insets
@@ -34,7 +34,7 @@ class EditorWebviewZone implements IViewZone {
3434
readonly editor: IActiveCodeEditor,
3535
readonly line: number,
3636
readonly height: number,
37-
readonly webview: WebviewElement,
37+
readonly webview: IWebviewElement,
3838
) {
3939
this.domNode = document.createElement('div');
4040
this.domNode.style.zIndex = '10'; // without this, the webview is not interactive

src/vs/workbench/api/browser/mainThreadWebviews.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
1515
import { IProductService } from 'vs/platform/product/common/productService';
1616
import * as extHostProtocol from 'vs/workbench/api/common/extHost.protocol';
1717
import { serializeWebviewMessage, deserializeWebviewMessage } from 'vs/workbench/api/common/extHostWebviewMessaging';
18-
import { Webview, WebviewContentOptions, WebviewExtensionDescription, WebviewOverlay } from 'vs/workbench/contrib/webview/browser/webview';
18+
import { IWebview, WebviewContentOptions, WebviewExtensionDescription, IOverlayWebview } from 'vs/workbench/contrib/webview/browser/webview';
1919

2020
export class MainThreadWebviews extends Disposable implements extHostProtocol.MainThreadWebviewsShape {
2121

@@ -29,7 +29,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
2929

3030
private readonly _proxy: extHostProtocol.ExtHostWebviewsShape;
3131

32-
private readonly _webviews = new Map<string, Webview>();
32+
private readonly _webviews = new Map<string, IWebview>();
3333

3434
constructor(
3535
context: extHostProtocol.IExtHostContext,
@@ -41,7 +41,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
4141
this._proxy = context.getProxy(extHostProtocol.ExtHostContext.ExtHostWebviews);
4242
}
4343

44-
public addWebview(handle: extHostProtocol.WebviewHandle, webview: WebviewOverlay, options: { serializeBuffersForPostMessage: boolean }): void {
44+
public addWebview(handle: extHostProtocol.WebviewHandle, webview: IOverlayWebview, options: { serializeBuffersForPostMessage: boolean }): void {
4545
if (this._webviews.has(handle)) {
4646
throw new Error('Webview already registered');
4747
}
@@ -67,7 +67,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
6767
return true;
6868
}
6969

70-
private hookupWebviewEventDelegate(handle: extHostProtocol.WebviewHandle, webview: WebviewOverlay, options: { serializeBuffersForPostMessage: boolean }) {
70+
private hookupWebviewEventDelegate(handle: extHostProtocol.WebviewHandle, webview: IOverlayWebview, options: { serializeBuffersForPostMessage: boolean }) {
7171
const disposables = new DisposableStore();
7272

7373
disposables.add(webview.onDidClickLink((uri) => this.onDidClickLink(handle, uri)));
@@ -92,7 +92,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
9292
}
9393
}
9494

95-
private isSupportedLink(webview: Webview, link: URI): boolean {
95+
private isSupportedLink(webview: IWebview, link: URI): boolean {
9696
if (MainThreadWebviews.standardSupportedLinkSchemes.has(link.scheme)) {
9797
return true;
9898
}
@@ -102,7 +102,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
102102
return !!webview.contentOptions.enableCommandUris && link.scheme === Schemas.command;
103103
}
104104

105-
private getWebview(handle: extHostProtocol.WebviewHandle): Webview {
105+
private getWebview(handle: extHostProtocol.WebviewHandle): IWebview {
106106
const webview = this._webviews.get(handle);
107107
if (!webview) {
108108
throw new Error(`Unknown webview handle:${handle}`);

src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
2020
import { DEFAULT_EDITOR_ASSOCIATION, EditorInputCapabilities, GroupIdentifier, IRevertOptions, ISaveOptions, isEditorInputWithOptionsAndGroup, IUntypedEditorInput, Verbosity } from 'vs/workbench/common/editor';
2121
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
2222
import { ICustomEditorModel, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor';
23-
import { IWebviewService, WebviewOverlay } from 'vs/workbench/contrib/webview/browser/webview';
23+
import { IWebviewService, IOverlayWebview } from 'vs/workbench/contrib/webview/browser/webview';
2424
import { IWebviewWorkbenchService, LazilyResolvedWebviewEditorInput } from 'vs/workbench/contrib/webviewPanel/browser/webviewWorkbenchService';
2525
import { IEditorResolverService } from 'vs/workbench/services/editor/common/editorResolverService';
2626
import { IUntitledTextEditorService } from 'vs/workbench/services/untitled/common/untitledTextEditorService';
@@ -66,7 +66,7 @@ export class CustomEditorInput extends LazilyResolvedWebviewEditorInput {
6666
resource: URI,
6767
viewType: string,
6868
id: string,
69-
webview: WebviewOverlay,
69+
webview: IOverlayWebview,
7070
options: { startsDirty?: boolean, backupId?: string, untitledDocumentData?: VSBuffer, readonly oldResource?: URI },
7171
@IWebviewWorkbenchService webviewWorkbenchService: IWebviewWorkbenchService,
7272
@IInstantiationService private readonly instantiationService: IInstantiationService,

src/vs/workbench/contrib/extensions/browser/extensionEditor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
5050
import { getDefaultValue } from 'vs/platform/configuration/common/configurationRegistry';
5151
import { isUndefined } from 'vs/base/common/types';
5252
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
53-
import { IWebviewService, Webview, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED } from 'vs/workbench/contrib/webview/browser/webview';
53+
import { IWebviewService, IWebview, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED } from 'vs/workbench/contrib/webview/browser/webview';
5454
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
5555
import { generateUuid } from 'vs/base/common/uuid';
5656
import { platform } from 'vs/base/common/process';
@@ -554,11 +554,11 @@ export class ExtensionEditor extends EditorPane {
554554
this.activeWebview?.runFindAction(previous);
555555
}
556556

557-
public get activeWebview(): Webview | undefined {
558-
if (!this.activeElement || !(this.activeElement as Webview).runFindAction) {
557+
public get activeWebview(): IWebview | undefined {
558+
if (!this.activeElement || !(this.activeElement as IWebview).runFindAction) {
559559
return undefined;
560560
}
561-
return this.activeElement as Webview;
561+
return this.activeElement as IWebview;
562562
}
563563

564564
private onNavbarChange(extension: IExtension, { id, focus }: { id: string | null, focus: boolean }, template: IExtensionEditorTemplate): void {

src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import { CONTEXT_SYNC_ENABLEMENT } from 'vs/workbench/services/userDataSync/comm
4444
import { CopyAction, CutAction, PasteAction } from 'vs/editor/contrib/clipboard/clipboard';
4545
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
4646
import { MultiCommand } from 'vs/editor/browser/editorExtensions';
47-
import { Webview } from 'vs/workbench/contrib/webview/browser/webview';
47+
import { IWebview } from 'vs/workbench/contrib/webview/browser/webview';
4848
import { ExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/browser/extensionsWorkbenchService';
4949
import { WorkbenchStateContext } from 'vs/workbench/browser/contextkeys';
5050
import { CATEGORIES } from 'vs/workbench/common/actions';
@@ -366,7 +366,7 @@ CommandsRegistry.registerCommand({
366366
}
367367
});
368368

369-
function overrideActionForActiveExtensionEditorWebview(command: MultiCommand | undefined, f: (webview: Webview) => void) {
369+
function overrideActionForActiveExtensionEditorWebview(command: MultiCommand | undefined, f: (webview: IWebview) => void) {
370370
command?.addImplementation(105, 'extensions-editor', (accessor) => {
371371
const editorService = accessor.get(IEditorService);
372372
const editor = editorService.activeEditorPane;

src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { InputFocusedContextKey } from 'vs/platform/contextkey/common/contextkey
2424
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
2525
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
2626
import { RedoCommand, UndoCommand } from 'vs/editor/browser/editorExtensions';
27-
import { Webview } from 'vs/workbench/contrib/webview/browser/webview';
27+
import { IWebview } from 'vs/workbench/contrib/webview/browser/webview';
2828
import { CATEGORIES } from 'vs/workbench/common/actions';
2929
import { IOutputService } from 'vs/workbench/contrib/output/common/output';
3030
import { rendererLogChannelId } from 'vs/workbench/contrib/logs/common/logConstants';
@@ -41,7 +41,7 @@ function _log(loggerService: ILogService, str: string) {
4141
}
4242
}
4343

44-
function getFocusedWebviewDelegate(accessor: ServicesAccessor): Webview | undefined {
44+
function getFocusedWebviewDelegate(accessor: ServicesAccessor): IWebview | undefined {
4545
const loggerService = accessor.get(ILogService);
4646
const editorService = accessor.get(IEditorService);
4747
const editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
@@ -65,7 +65,7 @@ function getFocusedWebviewDelegate(accessor: ServicesAccessor): Webview | undefi
6565
return webview;
6666
}
6767

68-
function withWebview(accessor: ServicesAccessor, f: (webviewe: Webview) => void) {
68+
function withWebview(accessor: ServicesAccessor, f: (webviewe: IWebview) => void) {
6969
const webview = getFocusedWebviewDelegate(accessor);
7070
if (webview) {
7171
f(webview);

src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { CellViewModel, IModelDecorationsChangeAccessor, INotebookEditorViewStat
1616
import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
1717
import { CellKind, NotebookCellMetadata, IOrderedMimeType, INotebookRendererInfo, ICellOutput, INotebookCellStatusBarItem, NotebookCellInternalMetadata, NotebookDocumentMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon';
1818
import { ICellRange, cellRangesToIndexes, reduceCellRanges } from 'vs/workbench/contrib/notebook/common/notebookRange';
19-
import { Webview } from 'vs/workbench/contrib/webview/browser/webview';
19+
import { IWebview } from 'vs/workbench/contrib/webview/browser/webview';
2020
import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel';
2121
import { MenuId } from 'vs/platform/actions/common/actions';
2222
import { IEditorPane } from 'vs/workbench/common/editor';
@@ -430,7 +430,7 @@ export interface INotebookEditor {
430430
hasModel(): this is IActiveNotebookEditor;
431431
dispose(): void;
432432
getDomNode(): HTMLElement;
433-
getInnerWebview(): Webview | undefined;
433+
getInnerWebview(): IWebview | undefined;
434434
getSelectionViewModels(): ICellViewModel[];
435435

436436
/**

src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/no
5858
import { CellKind, SelectionStateType } from 'vs/workbench/contrib/notebook/common/notebookCommon';
5959
import { ICellRange } from 'vs/workbench/contrib/notebook/common/notebookRange';
6060
import { editorGutterModifiedBackground } from 'vs/workbench/contrib/scm/browser/dirtydiffDecorator';
61-
import { Webview } from 'vs/workbench/contrib/webview/browser/webview';
61+
import { IWebview } from 'vs/workbench/contrib/webview/browser/webview';
6262
import { mark } from 'vs/workbench/contrib/notebook/common/notebookPerformance';
6363
import { readFontInfo } from 'vs/editor/browser/config/configuration';
6464
import { INotebookKernelService } from 'vs/workbench/contrib/notebook/common/notebookKernelService';
@@ -1055,7 +1055,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
10551055
return this._overflowContainer;
10561056
}
10571057

1058-
getInnerWebview(): Webview | undefined {
1058+
getInnerWebview(): IWebview | undefined {
10591059
return this._webview?.webview;
10601060
}
10611061

src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import { INotebookRendererInfo, RendererMessagingSpec } from 'vs/workbench/contr
3636
import { INotebookKernel } from 'vs/workbench/contrib/notebook/common/notebookKernelService';
3737
import { IScopedRendererMessaging } from 'vs/workbench/contrib/notebook/common/notebookRendererMessagingService';
3838
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
39-
import { IWebviewService, WebviewContentPurpose, WebviewElement } from 'vs/workbench/contrib/webview/browser/webview';
39+
import { IWebviewService, WebviewContentPurpose, IWebviewElement } from 'vs/workbench/contrib/webview/browser/webview';
4040
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
4141
import { FromWebviewMessage, IAckOutputHeight, IClickedDataUrlMessage, IContentWidgetTopRequest, IControllerPreload, ICreationRequestMessage, IMarkupCellInitialization, ToWebviewMessage } from './webviewMessages';
4242

@@ -60,7 +60,7 @@ export interface INotebookWebviewMessage {
6060
}
6161

6262
export interface IResolvedBackLayerWebview {
63-
webview: WebviewElement;
63+
webview: IWebviewElement;
6464
}
6565

6666
/**
@@ -87,7 +87,7 @@ export interface INotebookDelegateForWebview {
8787

8888
export class BackLayerWebView<T extends ICommonCellInfo> extends Disposable {
8989
element: HTMLElement;
90-
webview: WebviewElement | undefined = undefined;
90+
webview: IWebviewElement | undefined = undefined;
9191
insetMapping: Map<IDisplayOutputViewModel, ICachedInset<T>> = new Map();
9292
readonly markupPreviewMapping = new Map<string, IMarkupCellInitialization>();
9393
private hiddenInsetMapping: Set<IDisplayOutputViewModel> = new Set();

src/vs/workbench/contrib/webview/browser/dynamicWebviewEditorOverlay.ts renamed to src/vs/workbench/contrib/webview/browser/overlayWebview.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ import { URI } from 'vs/base/common/uri';
1111
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
1212
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
1313
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
14-
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';
14+
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';
1515

1616
/**
17-
* Webview editor overlay that creates and destroys the underlying webview as needed.
17+
* Webview that is absolutely positioned over another element and that can creates and destroys an underlying webview as needed.
1818
*/
19-
export class DynamicWebviewEditorOverlay extends Disposable implements WebviewOverlay {
19+
export class OverlayWebview extends Disposable implements IOverlayWebview {
2020

2121
private readonly _onDidWheel = this._register(new Emitter<IMouseWheelEvent>());
2222
public readonly onDidWheel = this._onDidWheel.event;
2323

2424
private readonly _pendingMessages = new Set<{ readonly message: any, readonly transfer?: readonly ArrayBuffer[] }>();
25-
private readonly _webview = this._register(new MutableDisposable<WebviewElement>());
25+
private readonly _webview = this._register(new MutableDisposable<IWebviewElement>());
2626
private readonly _webviewEvents = this._register(new DisposableStore());
2727

2828
private _html: string = '';
@@ -299,7 +299,7 @@ export class DynamicWebviewEditorOverlay extends Disposable implements WebviewOv
299299

300300
runFindAction(previous: boolean): void { this._webview.value?.runFindAction(previous); }
301301

302-
private withWebview(f: (webview: Webview) => void): void {
302+
private withWebview(f: (webview: IWebview) => void): void {
303303
if (this._webview.value) {
304304
f(this._webview.value);
305305
}

0 commit comments

Comments
 (0)