Skip to content

Commit df9f155

Browse files
authored
Fix custom editors always starting as active (microsoft#181287)
Fixes microsoft#152419
1 parent 06ff877 commit df9f155

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { WebviewInput } from 'vs/workbench/contrib/webviewPanel/browser/webviewE
3535
import { IWebviewWorkbenchService } from 'vs/workbench/contrib/webviewPanel/browser/webviewWorkbenchService';
3636
import { editorGroupToColumn } from 'vs/workbench/services/editor/common/editorGroupColumn';
3737
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
38+
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
3839
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
3940
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
4041
import { IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers';
@@ -71,6 +72,7 @@ export class MainThreadCustomEditors extends Disposable implements extHostProtoc
7172
@IEditorGroupsService private readonly _editorGroupService: IEditorGroupsService,
7273
@IWebviewWorkbenchService private readonly _webviewWorkbenchService: IWebviewWorkbenchService,
7374
@IInstantiationService private readonly _instantiationService: IInstantiationService,
75+
@IEditorService private readonly _editorService: IEditorService,
7476
) {
7577
super();
7678

@@ -199,6 +201,7 @@ export class MainThreadCustomEditors extends Disposable implements extHostProtoc
199201
title: webviewInput.getTitle(),
200202
contentOptions: webviewInput.webview.contentOptions,
201203
options: webviewInput.webview.options,
204+
active: webviewInput === this._editorService.activeEditor,
202205
}, editorGroupToColumn(this._editorGroupService, webviewInput.group || 0), cancellation);
203206
} catch (error) {
204207
onUnexpectedError(error);

src/vs/workbench/api/common/extHost.protocol.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,7 @@ export interface ExtHostCustomEditorsShape {
923923
title: string;
924924
contentOptions: IWebviewContentOptions;
925925
options: IWebviewPanelOptions;
926+
active: boolean;
926927
},
927928
position: EditorGroupColumn,
928929
cancellation: CancellationToken

src/vs/workbench/api/common/extHostCustomEditors.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ export class ExtHostCustomEditors implements extHostProtocol.ExtHostCustomEditor
254254
title: string;
255255
contentOptions: extHostProtocol.IWebviewContentOptions;
256256
options: extHostProtocol.IWebviewPanelOptions;
257+
active: boolean;
257258
},
258259
position: EditorGroupColumn,
259260
cancellation: CancellationToken,
@@ -266,7 +267,7 @@ export class ExtHostCustomEditors implements extHostProtocol.ExtHostCustomEditor
266267
const viewColumn = typeConverters.ViewColumn.to(position);
267268

268269
const webview = this._extHostWebview.createNewWebview(handle, initData.contentOptions, entry.extension);
269-
const panel = this._extHostWebviewPanels.createNewWebviewPanel(handle, viewType, initData.title, viewColumn, initData.options, webview, true);
270+
const panel = this._extHostWebviewPanels.createNewWebviewPanel(handle, viewType, initData.title, viewColumn, initData.options, webview, initData.active);
270271

271272
const revivedResource = URI.revive(resource);
272273

0 commit comments

Comments
 (0)