Skip to content

Commit 589aba9

Browse files
author
aiday-mar
committed
Filtering the ranges with the hidden ranges from folding. Fixes microsoft#156268.
1 parent 1fdade8 commit 589aba9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { LineDecoration } from 'vs/editor/common/viewLayout/lineDecorations';
1919
import { RunOnceScheduler } from 'vs/base/common/async';
2020
import { IModelTokensChangedEvent } from 'vs/editor/common/textModelEvents';
2121
import { Position } from 'vs/editor/common/core/position';
22+
import { Range } from 'vs/editor/common/core/range';
2223

2324
class StickyScrollController extends Disposable implements IEditorContribution {
2425

@@ -61,6 +62,7 @@ class StickyScrollController extends Disposable implements IEditorContribution {
6162
this._editor.addOverlayWidget(this.stickyScrollWidget);
6263
this._sessionStore.add(this._editor.onDidChangeModel(() => this._update(true)));
6364
this._sessionStore.add(this._editor.onDidScrollChange(() => this._update(false)));
65+
this._sessionStore.add(this._editor.onDidChangeHiddenAreas(() => this._update(true)));
6466
this._sessionStore.add(this._editor.onDidChangeModelTokens((e) => this._onTokensChange(e)));
6567
this._sessionStore.add(this._editor.onDidChangeModelContent(() => this._updateSoon.schedule()));
6668
this._sessionStore.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(() => this._update(true)));
@@ -92,6 +94,12 @@ class StickyScrollController extends Disposable implements IEditorContribution {
9294
this._cts = new CancellationTokenSource();
9395
await this._updateOutlineModel(this._cts.token);
9496
}
97+
const hiddenRanges: Range[] | undefined = this._editor._getViewModel()?.getHiddenAreas();
98+
if (hiddenRanges) {
99+
for (const hiddenRange of hiddenRanges) {
100+
this._ranges = this._ranges.filter(range => { return !(range[0] >= hiddenRange.startLineNumber && range[1] <= hiddenRange.endLineNumber + 1); });
101+
}
102+
}
95103
this._renderStickyScroll();
96104
}
97105

0 commit comments

Comments
 (0)