Skip to content

Commit d69ebf9

Browse files
author
aiday-mar
committed
work in progress
1 parent c1a6c51 commit d69ebf9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export class StickyLineCandidateProvider extends Disposable {
9797
}
9898
}
9999

100+
// consider the case when index = -length - 1
100101
private updatedIndex(index: number) {
101102
if (index === -1) {
102103
index = 0;
@@ -111,10 +112,15 @@ export class StickyLineCandidateProvider extends Disposable {
111112
return;
112113
}
113114
let lastLine = lastStartLineNumber;
114-
const childrenStartLines = outlineModel.children.map(child => child.range?.startLineNumber as number);
115+
const childrenStartLines = outlineModel.children.filter(child => { return child.range?.startLineNumber !== child.range?.endLineNumber; }).map(child => child.range?.startLineNumber as number);
116+
console.log('childrenStartLines : ', childrenStartLines);
117+
console.log('range : ', range);
118+
console.log('start lines : ', childrenStartLines);
119+
console.log('b1 ', binarySearch(childrenStartLines, range.startLineNumber, (a: number, b: number) => { return a - b; }));
120+
console.log('b2 ', binarySearch(childrenStartLines, range.startLineNumber + depth, (a: number, b: number) => { return a - b; }));
115121
const indexLower = this.updatedIndex(binarySearch(childrenStartLines, range.startLineNumber, (a: number, b: number) => { return a - b; }));
116122
const indexUpper = this.updatedIndex(binarySearch(childrenStartLines, range.startLineNumber + depth, (a: number, b: number) => { return a - b; }));
117-
123+
console.log('indexLower : ', indexLower, ' and indexUpper : ', indexUpper);
118124
for (let i = indexLower; i <= indexUpper; i++) {
119125
const child = outlineModel.children[i];
120126
if (child.range) {
@@ -134,6 +140,7 @@ export class StickyLineCandidateProvider extends Disposable {
134140
public getCandidateStickyLinesIntersecting(range: StickyRange): StickyLineCandidate[] {
135141
let stickyLineCandidates: StickyLineCandidate[] = [];
136142
this.getCandidateStickyLinesIntersectingFromOutline(range, this._outlineModel as StickyOutlineElement, stickyLineCandidates, 0, -1);
143+
console.log('stickyLineCandidates : ', stickyLineCandidates);
137144
const hiddenRanges: Range[] | undefined = this._editor._getViewModel()?.getHiddenAreas();
138145
if (hiddenRanges) {
139146
for (const hiddenRange of hiddenRanges) {

0 commit comments

Comments
 (0)