From 2c876371f581ad48cc0b58af28616f331513cc77 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Wed, 25 Apr 2018 22:42:35 +0200 Subject: [PATCH] Fixes #20578: Maintain scroll state when disabling code lens --- src/vs/editor/contrib/codelens/codelensController.ts | 2 ++ 1 file changed, 2 insertions(+) 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);