diff --git a/src/vs/editor/contrib/codelens/codelensController.ts b/src/vs/editor/contrib/codelens/codelensController.ts index 901348a1e27..3a122545b63 100644 --- a/src/vs/editor/contrib/codelens/codelensController.ts +++ b/src/vs/editor/contrib/codelens/codelensController.ts @@ -171,11 +171,13 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { this._localToDispose.push({ dispose: () => { if (this._editor.getModel()) { + const scrollState = StableEditorScrollState.capture(this._editor); this._editor.changeDecorations((changeAccessor) => { this._editor.changeViewZones((accessor) => { this._disposeAllLenses(changeAccessor, accessor); }); }); + scrollState.restore(this._editor); } else { // No accessors available this._disposeAllLenses(null, null);