@@ -3582,11 +3582,11 @@ export class TestState {
3582
3582
3583
3583
let baselineContent = "" ;
3584
3584
let offset = 0 ;
3585
- files . forEach ( f => {
3585
+ for ( const f of files ) {
3586
3586
const result = getLinkedEditingBaselineWorker ( f , offset , this . languageService ) ;
3587
3587
baselineContent += result . baselineContent + `\n\n\n` ;
3588
3588
offset = result . offset ;
3589
- } ) ;
3589
+ }
3590
3590
3591
3591
Harness . Baseline . runBaseline ( baselineFile , baselineContent ) ;
3592
3592
@@ -3610,34 +3610,35 @@ export class TestState {
3610
3610
return { baselineContent : baselineContent + activeFile . content + `\n\n--No linked edits found--` , offset } ;
3611
3611
}
3612
3612
3613
- let inlineLinkedEditBaseline : { start : number , end : number , index : number } [ ] = [ ] ;
3613
+ let inlineLinkedEditBaselines : { start : number , end : number , index : number } [ ] = [ ] ;
3614
3614
let linkedEditInfoBaseline = "" ;
3615
- linkedEditsByRange . forEach ( ( [ linkedEdit , positions ] ) => {
3615
+ for ( const edit of linkedEditsByRange ) {
3616
+ const [ linkedEdit , positions ] = edit ;
3616
3617
let rangeStart = 0 ;
3617
3618
for ( let j = 0 ; j < positions . length - 1 ; j ++ ) {
3618
3619
// for each distinct range in the list of positions, add an entry to the list of places that need to be annotated in the baseline
3619
3620
if ( positions [ j ] + 1 !== positions [ j + 1 ] ) {
3620
- inlineLinkedEditBaseline . push ( { start : positions [ rangeStart ] , end : positions [ j ] , index : offset } ) ;
3621
+ inlineLinkedEditBaselines . push ( { start : positions [ rangeStart ] , end : positions [ j ] , index : offset } ) ;
3621
3622
rangeStart = j + 1 ;
3622
3623
}
3623
3624
}
3624
- inlineLinkedEditBaseline . push ( { start : positions [ rangeStart ] , end : positions [ positions . length - 1 ] , index : offset } ) ;
3625
+ inlineLinkedEditBaselines . push ( { start : positions [ rangeStart ] , end : positions [ positions . length - 1 ] , index : offset } ) ;
3625
3626
3626
3627
// add the LinkedEditInfo with its index to the baseline
3627
3628
linkedEditInfoBaseline += `\n\n=== ${ offset } ===\n` + linkedEdit ;
3628
3629
offset ++ ;
3629
- } ) ;
3630
+ }
3630
3631
3631
- inlineLinkedEditBaseline = inlineLinkedEditBaseline . sort ( ( a , b ) => a . start - b . start ) ;
3632
+ inlineLinkedEditBaselines = inlineLinkedEditBaselines . sort ( ( a , b ) => a . start - b . start ) ;
3632
3633
const fileText = activeFile . content ;
3633
- baselineContent += fileText . slice ( 0 , inlineLinkedEditBaseline [ 0 ] . start ) ;
3634
- for ( let i = 0 ; i < inlineLinkedEditBaseline . length - 1 ; i ++ ) {
3635
- const e = inlineLinkedEditBaseline [ i ] ;
3636
- baselineContent += `[|/*${ e . index } */` + fileText . slice ( e . start , e . end ) + `|]` + fileText . slice ( e . end , inlineLinkedEditBaseline [ i + 1 ] . start ) ;
3634
+ baselineContent += fileText . slice ( 0 , inlineLinkedEditBaselines [ 0 ] . start ) ;
3635
+ for ( let i = 0 ; i < inlineLinkedEditBaselines . length ; i ++ ) {
3636
+ const e = inlineLinkedEditBaselines [ i ] ;
3637
+ const sliceEnd = inlineLinkedEditBaselines [ i + 1 ] ?. start ;
3638
+ baselineContent += `[|/*${ e . index } */` + fileText . slice ( e . start , e . end ) + `|]` + fileText . slice ( e . end , sliceEnd ) ;
3637
3639
}
3638
- const n = inlineLinkedEditBaseline [ inlineLinkedEditBaseline . length - 1 ] ;
3639
- baselineContent += `[|/*${ n . index } */` + fileText . slice ( n . start , n . end ) + `|]` + fileText . slice ( inlineLinkedEditBaseline [ inlineLinkedEditBaseline . length - 1 ] . end ) + linkedEditInfoBaseline ;
3640
3640
3641
+ baselineContent += linkedEditInfoBaseline ;
3641
3642
return { baselineContent, offset } ;
3642
3643
}
3643
3644
}
0 commit comments