Make sure we convert webview view columns if needed

Fixes #138914
This commit is contained in:
Matt Bierner
2022-01-20 18:27:03 -08:00
parent cbc320c890
commit 57e2ed6168
3 changed files with 16 additions and 6 deletions

View File

@@ -154,9 +154,10 @@ export class MainThreadWebviewPanels extends Disposable implements extHostProtoc
initData: extHostProtocol.IWebviewInitData,
showOptions: extHostProtocol.WebviewPanelShowOptions,
): void {
const targetGroup = this.getTargetGroupFromShowOptions(showOptions);
const mainThreadShowOptions: ICreateWebViewShowOptions = showOptions ? {
preserveFocus: !!showOptions.preserveFocus,
group: columnToEditorGroup(this._editorGroupService, showOptions.viewColumn)
group: targetGroup
} : {};
const extension = reviveWebviewExtension(extensionData);
@@ -197,7 +198,19 @@ export class MainThreadWebviewPanels extends Disposable implements extHostProtoc
return;
}
this._webviewWorkbenchService.revealWebview(webview, showOptions.viewColumn ?? ACTIVE_GROUP, !!showOptions.preserveFocus);
const targetGroup = this.getTargetGroupFromShowOptions(showOptions);
this._webviewWorkbenchService.revealWebview(webview, targetGroup, !!showOptions.preserveFocus);
}
private getTargetGroupFromShowOptions(showOptions: extHostProtocol.WebviewPanelShowOptions) {
if (typeof showOptions.viewColumn !== 'undefined') {
if (showOptions.viewColumn >= 0) {
return columnToEditorGroup(this._editorGroupService, showOptions.viewColumn);
} else {
return showOptions.viewColumn;
}
}
return ACTIVE_GROUP;
}
public $registerSerializer(viewType: string, options: { serializeBuffersForPostMessage: boolean }): void {

View File

@@ -151,7 +151,7 @@ class ExtHostWebviewPanel extends Disposable implements vscode.WebviewPanel {
public reveal(viewColumn?: vscode.ViewColumn, preserveFocus?: boolean): void {
this.assertNotDisposed();
this.#proxy.$reveal(this.#handle, {
viewColumn: viewColumn ? typeConverters.ViewColumn.from(viewColumn) : undefined,
viewColumn: typeof viewColumn === 'undefined' ? undefined : typeConverters.ViewColumn.from(viewColumn),
preserveFocus: !!preserveFocus
});
}