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

Trace for notebook editor markup warmup #161516

Merged
merged 1 commit into from Sep 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -85,6 +85,7 @@ import { EditorExtensionsRegistry } from 'vs/editor/browser/editorExtensions';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { NotebookPerfMarks } from 'vs/workbench/contrib/notebook/common/notebookPerformance';
import { BaseCellEditorOptions } from 'vs/workbench/contrib/notebook/browser/viewModel/cellEditorOptions';
import { ILogService } from 'vs/platform/log/common/log';

const $ = DOM.$;

Expand Down Expand Up @@ -255,6 +256,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
@INotebookExecutionService private readonly notebookExecutionService: INotebookExecutionService,
@INotebookExecutionStateService notebookExecutionStateService: INotebookExecutionStateService,
@IEditorProgressService private readonly editorProgressService: IEditorProgressService,
@ILogService private readonly logService: ILogService
) {
super();
this.isEmbedded = creationOptions.isEmbedded ?? false;
Expand Down Expand Up @@ -1481,12 +1483,15 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD

private async _warmupWithMarkdownRenderer(viewModel: NotebookViewModel, viewState: INotebookEditorViewState | undefined) {

this.logService.trace('NotebookEditorWidget.warmup', this.viewModel?.uri.toString());
await this._resolveWebview();
this.logService.trace('NotebookEditorWidget.warmup - webview resolved');

// make sure that the webview is not visible otherwise users will see pre-rendered markdown cells in wrong position as the list view doesn't have a correct `top` offset yet
this._webview!.element.style.visibility = 'hidden';
// warm up can take around 200ms to load markdown libraries, etc.
await this._warmupViewport(viewModel, viewState);
this.logService.trace('NotebookEditorWidget.warmup - viewport warmed up');

// todo@rebornix @mjbvz, is this too complicated?

Expand All @@ -1505,7 +1510,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
this._list.scrollTop = viewState?.scrollPosition?.top ?? 0;
this._debug('finish initial viewport warmup and view state restore.');
this._webview!.element.style.visibility = 'visible';

this.logService.trace('NotebookEditorWidget.warmup - list view model attached, set to visible');
}

private async _warmupViewport(viewModel: NotebookViewModel, viewState: INotebookEditorViewState | undefined) {
Expand Down