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

Allow doing editor layout without rendering immediately #198957

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions src/vs/editor/browser/widget/codeEditorWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1417,9 +1417,11 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
this._modelData.view.delegateScrollFromMouseWheelEvent(browserEvent);
}

public layout(dimension?: IDimension): void {
public layout(dimension?: IDimension, postponeRendering: boolean = false): void {
this._configuration.observeContainer(dimension);
this.render();
if (!postponeRendering) {
this.render();
}
}

public focus(): void {
Expand Down
5 changes: 4 additions & 1 deletion src/vs/editor/common/editorCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,11 @@ export interface IEditor {
* be called when the container of the editor gets resized.
*
* If a dimension is passed in, the passed in value will be used.
*
* By default, this will also render the editor immediately.
* If you prefer to delay rendering to the next animation frame, use postponeRendering == true.
*/
layout(dimension?: IDimension): void;
layout(dimension?: IDimension, postponeRendering?: boolean): void;

/**
* Brings browser focus to the editor text
Expand Down
5 changes: 4 additions & 1 deletion src/vs/monaco.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2569,8 +2569,11 @@ declare namespace monaco.editor {
* be called when the container of the editor gets resized.
*
* If a dimension is passed in, the passed in value will be used.
*
* By default, this will also render the editor immediately.
* If you prefer to delay rendering to the next animation frame, use postponeRendering == true.
*/
layout(dimension?: IDimension): void;
layout(dimension?: IDimension, postponeRendering?: boolean): void;
/**
* Brings browser focus to the editor text
*/
Expand Down