Skip to content

Commit 006ac78

Browse files
author
aiday-mar
committed
Cleaning the code
1 parent effac1d commit 006ac78

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,27 +108,18 @@ export class StickyLineCandidateProvider extends Disposable {
108108
}
109109

110110
public getCandidateStickyLinesIntersectingFromOutline(range: StickyRange, outlineModel: StickyOutlineElement, result: StickyLineCandidate[], depth: number, lastStartLineNumber: number): void {
111-
if (outlineModel.children.length === 0) {
111+
if (!outlineModel || outlineModel.children.length === 0) {
112112
return;
113113
}
114114
let lastLine = lastStartLineNumber;
115115
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; }));
121-
console.log('childrenStartLines : ', childrenStartLines);
122116
const indexLower = this.updatedIndex(binarySearch(childrenStartLines, range.startLineNumber, (a: number, b: number) => { return a - b; }));
123117
const indexUpper = this.updatedIndex(binarySearch(childrenStartLines, range.startLineNumber + depth, (a: number, b: number) => { return a - b; }));
124-
console.log('indexLower : ', indexLower, ' and indexUpper : ', indexUpper);
125118
for (let i = indexLower; i <= indexUpper; i++) {
126-
console.log('index i : ', i);
127119
const child = outlineModel.children.filter(child => { return child.range?.startLineNumber !== child.range?.endLineNumber; })[i];
128-
if (child.range) {
120+
if (child && child.range) {
129121
const childStartLine = child.range.startLineNumber;
130122
const childEndLine = child.range.endLineNumber;
131-
console.log('for range : ', child.range, ' our range : ', range, ' we are outside the if condition');
132123
if (range.startLineNumber <= childEndLine + 1 && childStartLine - 1 <= range.endLineNumber && childStartLine !== lastLine) {
133124
lastLine = childStartLine;
134125
result.push(new StickyLineCandidate(childStartLine, childEndLine - 1, depth + 1));
@@ -143,7 +134,6 @@ export class StickyLineCandidateProvider extends Disposable {
143134
public getCandidateStickyLinesIntersecting(range: StickyRange): StickyLineCandidate[] {
144135
let stickyLineCandidates: StickyLineCandidate[] = [];
145136
this.getCandidateStickyLinesIntersectingFromOutline(range, this._outlineModel as StickyOutlineElement, stickyLineCandidates, 0, -1);
146-
console.log('stickyLineCandidates : ', stickyLineCandidates);
147137
const hiddenRanges: Range[] | undefined = this._editor._getViewModel()?.getHiddenAreas();
148138
if (hiddenRanges) {
149139
for (const hiddenRange of hiddenRanges) {

0 commit comments

Comments
 (0)