Merge pull request #187692 from microsoft/hediet/b/cool-wolverine

Fixes #187063
This commit is contained in:
Henning Dieterichs 2023-07-12 15:05:43 +02:00 committed by GitHub
commit ba8caef810
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 1 deletions

View File

@ -1086,6 +1086,12 @@ export interface ICodeEditor extends editorCommon.IEditor {
hasModel(): this is IActiveCodeEditor;
setBanner(bannerDomNode: HTMLElement | null, height: number): void;
/**
* Is called when the model has been set, view state was restored and options are updated.
* This is the best place to compute data for the viewport (such as tokens).
*/
handleInitialized?(): void;
}
/**

View File

@ -1021,6 +1021,10 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
}
}
public handleInitialized(): void {
this._getViewModel()?.visibleLinesStabilized();
}
public onVisible(): void {
this._modelData?.view.refreshFocusState();
}

View File

@ -642,7 +642,7 @@ class AttachedViewHandler extends Disposable {
}
private update(): void {
if (equals(this._computedLineRanges, this._lineRanges)) {
if (equals(this._computedLineRanges, this._lineRanges, (a, b) => a.equals(b))) {
return;
}
this._computedLineRanges = this._lineRanges;

5
src/vs/monaco.d.ts vendored
View File

@ -6065,6 +6065,11 @@ declare namespace monaco.editor {
*/
applyFontInfo(target: HTMLElement): void;
setBanner(bannerDomNode: HTMLElement | null, height: number): void;
/**
* Is called when the model has been set, view state was restored and options are updated.
* This is the best place to compute data for the viewport (such as tokens).
*/
handleInitialized?(): void;
}
/**

View File

@ -148,6 +148,10 @@ export class TextFileEditor extends AbstractTextCodeEditor<ICodeEditorViewState>
// a resolved model might have more specific information about being
// readonly or not that the input did not have.
control.updateOptions(this.getReadonlyConfiguration(textFileModel.isReadonly()));
if (control.handleInitialized) {
control.handleInitialized();
}
} catch (error) {
await this.handleSetInputError(error, input, options);
}