@@ -108,27 +108,18 @@ export class StickyLineCandidateProvider extends Disposable {
108
108
}
109
109
110
110
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 ) {
112
112
return ;
113
113
}
114
114
let lastLine = lastStartLineNumber ;
115
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 ; } ) ) ;
121
- console . log ( 'childrenStartLines : ' , childrenStartLines ) ;
122
116
const indexLower = this . updatedIndex ( binarySearch ( childrenStartLines , range . startLineNumber , ( a : number , b : number ) => { return a - b ; } ) ) ;
123
117
const indexUpper = this . updatedIndex ( binarySearch ( childrenStartLines , range . startLineNumber + depth , ( a : number , b : number ) => { return a - b ; } ) ) ;
124
- console . log ( 'indexLower : ' , indexLower , ' and indexUpper : ' , indexUpper ) ;
125
118
for ( let i = indexLower ; i <= indexUpper ; i ++ ) {
126
- console . log ( 'index i : ' , i ) ;
127
119
const child = outlineModel . children . filter ( child => { return child . range ?. startLineNumber !== child . range ?. endLineNumber ; } ) [ i ] ;
128
- if ( child . range ) {
120
+ if ( child && child . range ) {
129
121
const childStartLine = child . range . startLineNumber ;
130
122
const childEndLine = child . range . endLineNumber ;
131
- console . log ( 'for range : ' , child . range , ' our range : ' , range , ' we are outside the if condition' ) ;
132
123
if ( range . startLineNumber <= childEndLine + 1 && childStartLine - 1 <= range . endLineNumber && childStartLine !== lastLine ) {
133
124
lastLine = childStartLine ;
134
125
result . push ( new StickyLineCandidate ( childStartLine , childEndLine - 1 , depth + 1 ) ) ;
@@ -143,7 +134,6 @@ export class StickyLineCandidateProvider extends Disposable {
143
134
public getCandidateStickyLinesIntersecting ( range : StickyRange ) : StickyLineCandidate [ ] {
144
135
let stickyLineCandidates : StickyLineCandidate [ ] = [ ] ;
145
136
this . getCandidateStickyLinesIntersectingFromOutline ( range , this . _outlineModel as StickyOutlineElement , stickyLineCandidates , 0 , - 1 ) ;
146
- console . log ( 'stickyLineCandidates : ' , stickyLineCandidates ) ;
147
137
const hiddenRanges : Range [ ] | undefined = this . _editor . _getViewModel ( ) ?. getHiddenAreas ( ) ;
148
138
if ( hiddenRanges ) {
149
139
for ( const hiddenRange of hiddenRanges ) {
0 commit comments