@@ -295,7 +295,7 @@ namespace ts.textChanges {
295
295
}
296
296
297
297
private insertNodesAt ( sourceFile : SourceFile , pos : number , newNodes : ReadonlyArray < Node > , options : ReplaceWithMultipleNodesOptions = { } ) : void {
298
- this . changes . push ( { kind : ChangeKind . ReplaceWithMultipleNodes , sourceFile, options , nodes : newNodes , range : { pos , end : pos } } ) ;
298
+ this . replaceRangeWithNodes ( sourceFile , createRange ( pos ) , newNodes , options ) ;
299
299
}
300
300
301
301
public insertNodeAtTopOfFile ( sourceFile : SourceFile , newNode : Statement , blankLineBetween : boolean ) : void {
@@ -312,7 +312,7 @@ namespace ts.textChanges {
312
312
313
313
public insertModifierBefore ( sourceFile : SourceFile , modifier : SyntaxKind , before : Node ) : void {
314
314
const pos = before . getStart ( sourceFile ) ;
315
- this . replaceRange ( sourceFile , { pos, end : pos } , createToken ( modifier ) , { suffix : " " } ) ;
315
+ this . insertNodeAt ( sourceFile , pos , createToken ( modifier ) , { suffix : " " } ) ;
316
316
}
317
317
318
318
public insertLastModifierBefore ( sourceFile : SourceFile , modifier : SyntaxKind , before : Node ) : void {
@@ -322,7 +322,7 @@ namespace ts.textChanges {
322
322
}
323
323
324
324
const pos = before . modifiers . end ;
325
- this . replaceRange ( sourceFile , { pos, end : pos } , createToken ( modifier ) , { prefix : " " } ) ;
325
+ this . insertNodeAt ( sourceFile , pos , createToken ( modifier ) , { prefix : " " } ) ;
326
326
}
327
327
328
328
public insertCommentBeforeLine ( sourceFile : SourceFile , lineNumber : number , position : number , commentText : string ) : void {
@@ -413,7 +413,7 @@ namespace ts.textChanges {
413
413
414
414
public insertNodeAtEndOfScope ( sourceFile : SourceFile , scope : Node , newNode : Node ) : void {
415
415
const pos = getAdjustedStartPosition ( sourceFile , scope . getLastToken ( ) ! , { } , Position . Start ) ;
416
- this . replaceRange ( sourceFile , { pos, end : pos } , newNode , {
416
+ this . insertNodeAt ( sourceFile , pos , newNode , {
417
417
prefix : isLineBreak ( sourceFile . text . charCodeAt ( scope . getLastToken ( ) ! . pos ) ) ? this . newLineCharacter : this . newLineCharacter + this . newLineCharacter ,
418
418
suffix : this . newLineCharacter
419
419
} ) ;
0 commit comments