提交 06dd68b4 编写于 作者: M Matt Bierner

Fix webviews in same view column not always getting correct state change fired for visibility

Fixes #70859
上级 4f03abce
......@@ -112,7 +112,6 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
};
this._webviews.set(handle, webview);
this._activeWebview = handle;
/* __GDPR__
"webviews:createWebviewPanel" : {
......
......@@ -72,7 +72,6 @@ export class WebviewEditorInput extends EditorInput {
constructor(
public readonly viewType: string,
id: number,
name: string,
options: WebviewInputOptions,
state: any,
......@@ -85,8 +84,7 @@ export class WebviewEditorInput extends EditorInput {
) {
super();
this._id = id;
WebviewEditorInput.handlePool = Math.max(id, WebviewEditorInput.handlePool) + 1;
this._id = WebviewEditorInput.handlePool++;
this._name = name;
this._options = options;
......@@ -99,10 +97,6 @@ export class WebviewEditorInput extends EditorInput {
return WebviewEditorInput.typeId;
}
public getId(): number {
return this._id;
}
private readonly _onDidChangeIcon = this._register(new Emitter<void>());
public readonly onDidChangeIcon = this._onDidChangeIcon.event;
......@@ -157,7 +151,7 @@ export class WebviewEditorInput extends EditorInput {
}
public matches(other: IEditorInput): boolean {
return other === this || (other instanceof WebviewEditorInput && other._id === this._id);
return other === this;
}
public get group(): GroupIdentifier | undefined {
......@@ -312,7 +306,6 @@ export class RevivedWebviewEditorInput extends WebviewEditorInput {
constructor(
viewType: string,
id: number,
name: string,
options: WebviewInputOptions,
state: any,
......@@ -324,7 +317,7 @@ export class RevivedWebviewEditorInput extends WebviewEditorInput {
private readonly reviver: (input: WebviewEditorInput) => Promise<void>,
@IWorkbenchLayoutService partService: IWorkbenchLayoutService,
) {
super(viewType, id, name, options, state, events, extension, partService);
super(viewType, name, options, state, events, extension, partService);
}
public async resolve(): Promise<IEditorModel> {
......
......@@ -17,7 +17,6 @@ interface SerializedIconPath {
interface SerializedWebview {
readonly viewType: string;
readonly id: number;
readonly title: string;
readonly options: WebviewInputOptions;
readonly extensionLocation: string | UriComponents | undefined;
......@@ -44,7 +43,6 @@ export class WebviewEditorInputFactory implements IEditorInputFactory {
const data: SerializedWebview = {
viewType: input.viewType,
id: input.getId(),
title: input.getName(),
options: input.options,
extensionLocation: input.extension ? input.extension.location : undefined,
......@@ -69,7 +67,7 @@ export class WebviewEditorInputFactory implements IEditorInputFactory {
const extensionLocation = reviveUri(data.extensionLocation);
const extensionId = data.extensionId ? new ExtensionIdentifier(data.extensionId) : undefined;
const iconPath = reviveIconPath(data.iconPath);
return this._webviewService.reviveWebview(data.viewType, data.id, data.title, iconPath, data.state, data.options, extensionLocation ? {
return this._webviewService.reviveWebview(data.viewType, data.title, iconPath, data.state, data.options, extensionLocation ? {
location: extensionLocation,
id: extensionId
} : undefined, data.group);
......
......@@ -39,7 +39,6 @@ export interface IWebviewEditorService {
reviveWebview(
viewType: string,
id: number,
title: string,
iconPath: { light: URI, dark: URI } | undefined,
state: any,
......@@ -143,7 +142,7 @@ export class WebviewEditorService implements IWebviewEditorService {
},
events: WebviewEvents
): WebviewEditorInput {
const webviewInput = this._instantiationService.createInstance(WebviewEditorInput, viewType, undefined, title, options, {}, events, extension);
const webviewInput = this._instantiationService.createInstance(WebviewEditorInput, viewType, title, options, {}, events, extension);
this._editorService.openEditor(webviewInput, { pinned: true, preserveFocus: showOptions.preserveFocus }, showOptions.group);
return webviewInput;
}
......@@ -165,7 +164,6 @@ export class WebviewEditorService implements IWebviewEditorService {
public reviveWebview(
viewType: string,
id: number,
title: string,
iconPath: { light: URI, dark: URI } | undefined,
state: any,
......@@ -176,7 +174,7 @@ export class WebviewEditorService implements IWebviewEditorService {
},
group: number | undefined,
): WebviewEditorInput {
const webviewInput = this._instantiationService.createInstance(RevivedWebviewEditorInput, viewType, id, title, options, state, {}, extension, async (webview: WebviewEditorInput): Promise<void> => {
const webviewInput = this._instantiationService.createInstance(RevivedWebviewEditorInput, viewType, title, options, state, {}, extension, async (webview: WebviewEditorInput): Promise<void> => {
const didRevive = await this.tryRevive(webview);
if (didRevive) {
return Promise.resolve(undefined);
......@@ -220,7 +218,7 @@ export class WebviewEditorService implements IWebviewEditorService {
// Revived webviews may not have an actively registered reviver but we still want to presist them
// since a reviver should exist when it is actually needed.
return !(webview instanceof RevivedWebviewEditorInput);
return webview instanceof RevivedWebviewEditorInput;
}
private async tryRevive(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册