Skip to content

Commit ca08e56

Browse files
committed
reset sticky scroll rendering when having no model
fixes microsoft#165385
1 parent f8c9ae7 commit ca08e56

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/vs/editor/contrib/stickyScroll/browser/stickyScrollController.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,11 @@ export class StickyScrollController extends Disposable implements IEditorContrib
112112
return;
113113
}
114114
const model = this._editor.getModel();
115-
if (this._stickyLineCandidateProvider.getVersionId() !== model.getVersionId()) {
116-
// Old _ranges not updated yet
117-
return;
115+
const stickyLineVersion = this._stickyLineCandidateProvider.getVersionId();
116+
if (stickyLineVersion === undefined || stickyLineVersion === model.getVersionId()) {
117+
this._widgetState = this.getScrollWidgetState();
118+
this._stickyScrollWidget.setState(this._widgetState);
118119
}
119-
this._widgetState = this.getScrollWidgetState();
120-
this._stickyScrollWidget.setState(this._widgetState);
121120
}
122121

123122
public getScrollWidgetState(): StickyScrollWidgetState {

src/vs/editor/contrib/stickyScroll/browser/stickyScrollProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class StickyLineCandidateProvider extends Disposable {
9191
}
9292

9393
public getVersionId() {
94-
return this._model?.version ?? -1;
94+
return this._model?.version;
9595
}
9696

9797
public async update(): Promise<void> {

0 commit comments

Comments
 (0)