提交 954c5ae2 编写于 作者: M Matt Bierner

Don't set resource on webviews

Fixes #46217
上级 dd3ce6c8
...@@ -54,7 +54,7 @@ export class MainThreadWebviews implements MainThreadWebviewsShape { ...@@ -54,7 +54,7 @@ export class MainThreadWebviews implements MainThreadWebviewsShape {
options: vscode.WebviewOptions, options: vscode.WebviewOptions,
extensionFolderPath: string extensionFolderPath: string
): void { ): void {
const webviewInput = new WebviewInput(URI.parse('webview://' + handle), title, options, '', { const webviewInput = new WebviewInput(title, options, '', {
onMessage: message => this._proxy.$onMessage(handle, message), onMessage: message => this._proxy.$onMessage(handle, message),
onDidChangePosition: position => this._proxy.$onDidChangePosition(handle, position), onDidChangePosition: position => this._proxy.$onDidChangePosition(handle, position),
onDispose: () => { onDispose: () => {
......
...@@ -83,8 +83,7 @@ export class ReleaseNotesManager { ...@@ -83,8 +83,7 @@ export class ReleaseNotesManager {
this._editorService.openEditor(this._currentReleaseNotes, { preserveFocus: true }); this._editorService.openEditor(this._currentReleaseNotes, { preserveFocus: true });
} }
} else { } else {
const uri = URI.parse('release-notes:' + version); this._currentReleaseNotes = new WebviewInput(title, { tryRestoreScrollPosition: true, enableFindWidget: true }, html, {
this._currentReleaseNotes = new WebviewInput(uri, title, { tryRestoreScrollPosition: true, enableFindWidget: true }, html, {
onDidClickLink: uri => this.onDidClickLink(uri), onDidClickLink: uri => this.onDidClickLink(uri),
onDispose: () => { this._currentReleaseNotes = undefined; } onDispose: () => { this._currentReleaseNotes = undefined; }
}, this._partService); }, this._partService);
......
...@@ -141,7 +141,7 @@ export class WebviewEditor extends BaseWebviewEditor { ...@@ -141,7 +141,7 @@ export class WebviewEditor extends BaseWebviewEditor {
return undefined; return undefined;
} }
if (this.input && this.input.getResource().fsPath !== input.getResource().fsPath) { if (this.input) {
(this.input as WebviewInput).releaseWebview(this); (this.input as WebviewInput).releaseWebview(this);
this._webview = undefined; this._webview = undefined;
this.webviewContent = undefined; this.webviewContent = undefined;
......
...@@ -28,7 +28,6 @@ export interface WebviewInputOptions extends vscode.WebviewOptions { ...@@ -28,7 +28,6 @@ export interface WebviewInputOptions extends vscode.WebviewOptions {
export class WebviewInput extends EditorInput { export class WebviewInput extends EditorInput {
private static handlePool = 0; private static handlePool = 0;
private readonly _resource: URI;
private _name: string; private _name: string;
private _options: WebviewInputOptions; private _options: WebviewInputOptions;
private _html: string; private _html: string;
...@@ -43,7 +42,6 @@ export class WebviewInput extends EditorInput { ...@@ -43,7 +42,6 @@ export class WebviewInput extends EditorInput {
public readonly extensionFolderPath: URI | undefined; public readonly extensionFolderPath: URI | undefined;
constructor( constructor(
resource: URI,
name: string, name: string,
options: WebviewInputOptions, options: WebviewInputOptions,
html: string, html: string,
...@@ -52,7 +50,6 @@ export class WebviewInput extends EditorInput { ...@@ -52,7 +50,6 @@ export class WebviewInput extends EditorInput {
extensionFolderPath?: string extensionFolderPath?: string
) { ) {
super(); super();
this._resource = resource;
this._name = name; this._name = name;
this._options = options; this._options = options;
this._html = html; this._html = html;
...@@ -90,20 +87,28 @@ export class WebviewInput extends EditorInput { ...@@ -90,20 +87,28 @@ export class WebviewInput extends EditorInput {
} }
public getResource(): URI { public getResource(): URI {
return this._resource; return null;
} }
public getName(): string { public getName(): string {
return this._name; return this._name;
} }
public getTitle() {
return this.getName();
}
public getDescription(): string {
return null;
}
public setName(value: string): void { public setName(value: string): void {
this._name = value; this._name = value;
this._onDidChangeLabel.fire(); this._onDidChangeLabel.fire();
} }
matches(other: IEditorInput): boolean { matches(other: IEditorInput): boolean {
return other && other instanceof WebviewInput && other.getResource().fsPath === this.getResource().fsPath; return other && other === this;
} }
public get position(): Position | undefined { public get position(): Position | undefined {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册