提交 722f9720 编写于 作者: J Johannes Rieken

fix #79694

上级 46993bce
......@@ -32,7 +32,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
private _currentCodeLensModel: CodeLensModel | undefined;
private _modelChangeCounter: number = 0;
private _currentResolveCodeLensSymbolsPromise: CancelablePromise<any> | undefined;
private _detectVisibleLenses!: RunOnceScheduler;
private _detectVisibleLenses: RunOnceScheduler | undefined;
constructor(
private readonly _editor: editorBrowser.ICodeEditor,
......@@ -121,9 +121,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
}
}
this._detectVisibleLenses = new RunOnceScheduler(() => {
this._onViewportChanged();
}, 250);
const detectVisibleLenses = this._detectVisibleLenses = new RunOnceScheduler(() => this._onViewportChanged(), 250);
const scheduler = new RunOnceScheduler(() => {
const counterValue = ++this._modelChangeCounter;
......@@ -145,12 +143,12 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
// render lenses
this._renderCodeLensSymbols(result);
this._detectVisibleLenses.schedule();
detectVisibleLenses.schedule();
}
}, onUnexpectedError);
}, 250);
this._localToDispose.add(scheduler);
this._localToDispose.add(this._detectVisibleLenses);
this._localToDispose.add(detectVisibleLenses);
this._localToDispose.add(this._editor.onDidChangeModelContent(() => {
this._editor.changeDecorations(decorationsAccessor => {
this._editor.changeViewZones(viewZonesAccessor => {
......@@ -179,17 +177,17 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
});
// Compute new `visible` code lenses
this._detectVisibleLenses.schedule();
detectVisibleLenses.schedule();
// Ask for all references again
scheduler.schedule();
}));
this._localToDispose.add(this._editor.onDidScrollChange(e => {
if (e.scrollTopChanged && this._lenses.length > 0) {
this._detectVisibleLenses.schedule();
detectVisibleLenses.schedule();
}
}));
this._localToDispose.add(this._editor.onDidLayoutChange(() => {
this._detectVisibleLenses.schedule();
detectVisibleLenses.schedule();
}));
this._localToDispose.add(toDisposable(() => {
if (this._editor.getModel()) {
......@@ -281,7 +279,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
groupsIndex++;
codeLensIndex++;
} else {
this._lenses.splice(codeLensIndex, 0, new CodeLensWidget(groups[groupsIndex], this._editor, helper, viewZoneAccessor, () => this._detectVisibleLenses.schedule()));
this._lenses.splice(codeLensIndex, 0, new CodeLensWidget(groups[groupsIndex], this._editor, helper, viewZoneAccessor, () => this._detectVisibleLenses && this._detectVisibleLenses.schedule()));
codeLensIndex++;
groupsIndex++;
}
......@@ -295,7 +293,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
// Create extra symbols
while (groupsIndex < groups.length) {
this._lenses.push(new CodeLensWidget(groups[groupsIndex], this._editor, helper, viewZoneAccessor, () => this._detectVisibleLenses.schedule()));
this._lenses.push(new CodeLensWidget(groups[groupsIndex], this._editor, helper, viewZoneAccessor, () => this._detectVisibleLenses && this._detectVisibleLenses.schedule()));
groupsIndex++;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册