Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move off in Webview #206363

Merged
merged 18 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert unnecessary changes
  • Loading branch information
rebornix committed Feb 28, 2024
commit 2016fe770bfb057e41282fd9b1c040b6dde7c949
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class CustomEditorInput extends LazilyResolvedWebviewEditorInput {
title: undefined,
options: { customClasses: options?.customClasses },
contentOptions: {},
extension: undefined
extension: undefined,
});
const input = instantiationService.createInstance(CustomEditorInput, { resource, viewType }, webview, { untitledDocumentData: untitledDocumentData, oldResource: options?.oldResource });
if (typeof group !== 'undefined') {
Expand Down Expand Up @@ -135,7 +135,6 @@ export class CustomEditorInput extends LazilyResolvedWebviewEditorInput {
let capabilities = EditorInputCapabilities.None;

capabilities |= EditorInputCapabilities.CanDropIntoEditor;
bpasero marked this conversation as resolved.
Show resolved Hide resolved
// capabilities |= EditorInputCapabilities.AuxWindowUnsupported;

if (!this.customEditorService.getCustomEditorCapabilities(this.viewType)?.supportsMultipleEditorsPerDocument) {
capabilities |= EditorInputCapabilities.Singleton;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function reviveWebview(webviewService: IWebviewService, data: { origin: string |
retainContextWhenHidden: data.webviewOptions.retainContextWhenHidden,
},
contentOptions: data.contentOptions,
extension: data.extension
extension: data.extension,
});
webview.state = data.state;
return webview;
Expand Down Expand Up @@ -184,7 +184,7 @@ export class ComplexCustomWorkingCopyEditorHandler extends Disposable implements
webviewOptions: restoreWebviewOptions(backupData.webview.options),
contentOptions: restoreWebviewContentOptions(backupData.webview.options),
state: backupData.webview.state,
extension
extension,
});

const editor = this._instantiationService.createInstance(CustomEditorInput, { resource: URI.revive(backupData.editorResource), viewType: backupData.viewType }, webview, { backupId: backupData.backupId });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,6 @@ export class ExtensionEditor extends EditorPane {
return Promise.resolve(null);
}

const codeWindow = getWindowById(this.group?.windowId, true).window;

const webview = this.contentDisposables.add(this.webviewService.createWebviewOverlay({
title,
options: {
Expand All @@ -671,11 +669,12 @@ export class ExtensionEditor extends EditorPane {
disableServiceWorker: true,
},
contentOptions: {},
extension: undefined
extension: undefined,
}));

webview.initialScrollProgress = this.initialScrollProgress.get(webviewIndex) || 0;

const codeWindow = getWindowById(this.group?.windowId, true).window;
webview.claim(this, codeWindow, this.scopedContextKeyService);
setParentFlowTo(webview.container, container);
webview.layoutWebviewOverElement(container);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export class WebviewInput extends EditorInput {

public override get capabilities(): EditorInputCapabilities {
return EditorInputCapabilities.Readonly | EditorInputCapabilities.Singleton | EditorInputCapabilities.CanDropIntoEditor;
// | EditorInputCapabilities.AuxWindowUnsupported;
}

private readonly _resourceId = generateUuid();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { WebviewContentOptions, WebviewExtensionDescription, WebviewOptions } fr
import { WebviewIcons } from 'vs/workbench/contrib/webviewPanel/browser/webviewIconManager';
import { WebviewInput } from './webviewEditorInput';
import { IWebviewWorkbenchService } from './webviewWorkbenchService';
import { getWindow } from 'vs/base/browser/dom';

export type SerializedWebviewOptions = WebviewOptions & WebviewContentOptions;

Expand All @@ -31,7 +30,6 @@ export interface SerializedWebview {
readonly state: any;
readonly iconPath: SerializedIconPath | undefined;
readonly group?: number;
readonly windowId: number;
}

export interface DeserializedWebview {
Expand Down Expand Up @@ -84,7 +82,7 @@ export class WebviewEditorInputSerializer implements IEditorSerializer {
title: data.title,
options: data.webviewOptions,
contentOptions: data.contentOptions,
extension: data.extension
extension: data.extension,
},
viewType: data.viewType,
title: data.title,
Expand All @@ -101,7 +99,7 @@ export class WebviewEditorInputSerializer implements IEditorSerializer {
iconPath: reviveIconPath(data.iconPath),
state: reviveState(data.state),
webviewOptions: restoreWebviewOptions(data.options),
contentOptions: restoreWebviewContentOptions(data.options)
contentOptions: restoreWebviewContentOptions(data.options),
};
}

Expand All @@ -116,8 +114,7 @@ export class WebviewEditorInputSerializer implements IEditorSerializer {
extensionId: input.extension?.id.value,
state: input.webview.state,
iconPath: input.iconPath ? { light: input.iconPath.light, dark: input.iconPath.dark, } : undefined,
group: input.group,
windowId: getWindow(input.webview.container).vscodeWindowId
group: input.group
};
}
}
Expand Down
Loading