@@ -291,7 +291,7 @@ namespace ts.textChanges {
291
291
}
292
292
293
293
public insertNodeAt ( sourceFile : SourceFile , pos : number , newNode : Node , options : InsertNodeOptions = { } ) {
294
- this . replaceRange ( sourceFile , createTextRange ( pos ) , newNode , options ) ;
294
+ this . replaceRange ( sourceFile , createRange ( pos ) , newNode , options ) ;
295
295
}
296
296
297
297
private insertNodesAt ( sourceFile : SourceFile , pos : number , newNodes : ReadonlyArray < Node > , options : ReplaceWithMultipleNodesOptions = { } ) : void {
@@ -334,7 +334,7 @@ namespace ts.textChanges {
334
334
}
335
335
336
336
public insertText ( sourceFile : SourceFile , pos : number , text : string ) : void {
337
- this . replaceRangeWithText ( sourceFile , createTextRange ( pos ) , text ) ;
337
+ this . replaceRangeWithText ( sourceFile , createRange ( pos ) , text ) ;
338
338
}
339
339
340
340
/** Prefer this over replacing a node with another that has a type annotation, as it avoids reformatting the other parts of the node. */
@@ -456,7 +456,7 @@ namespace ts.textChanges {
456
456
// check if previous statement ends with semicolon
457
457
// if not - insert semicolon to preserve the code from changing the meaning due to ASI
458
458
if ( sourceFile . text . charCodeAt ( after . end - 1 ) !== CharacterCodes . semicolon ) {
459
- this . replaceRange ( sourceFile , createTextRange ( after . end ) , createToken ( SyntaxKind . SemicolonToken ) ) ;
459
+ this . replaceRange ( sourceFile , createRange ( after . end ) , createToken ( SyntaxKind . SemicolonToken ) ) ;
460
460
}
461
461
}
462
462
const endPosition = getAdjustedEndPosition ( sourceFile , after , { } ) ;
@@ -595,7 +595,7 @@ namespace ts.textChanges {
595
595
596
596
// write separator and leading trivia of the next element as suffix
597
597
const suffix = `${ tokenToString ( nextToken . kind ) } ${ sourceFile . text . substring ( nextToken . end , containingList [ index + 1 ] . getStart ( sourceFile ) ) } ` ;
598
- this . replaceRange ( sourceFile , createTextRange ( startPos , containingList [ index + 1 ] . getStart ( sourceFile ) ) , newNode , { prefix, suffix } ) ;
598
+ this . replaceRange ( sourceFile , createRange ( startPos , containingList [ index + 1 ] . getStart ( sourceFile ) ) , newNode , { prefix, suffix } ) ;
599
599
}
600
600
}
601
601
else {
@@ -629,18 +629,18 @@ namespace ts.textChanges {
629
629
}
630
630
if ( multilineList ) {
631
631
// insert separator immediately following the 'after' node to preserve comments in trailing trivia
632
- this . replaceRange ( sourceFile , createTextRange ( end ) , createToken ( separator ) ) ;
632
+ this . replaceRange ( sourceFile , createRange ( end ) , createToken ( separator ) ) ;
633
633
// use the same indentation as 'after' item
634
634
const indentation = formatting . SmartIndenter . findFirstNonWhitespaceColumn ( afterStartLinePosition , afterStart , sourceFile , this . formatContext . options ) ;
635
635
// insert element before the line break on the line that contains 'after' element
636
636
let insertPos = skipTrivia ( sourceFile . text , end , /*stopAfterLineBreak*/ true , /*stopAtComments*/ false ) ;
637
637
if ( insertPos !== end && isLineBreak ( sourceFile . text . charCodeAt ( insertPos - 1 ) ) ) {
638
638
insertPos -- ;
639
639
}
640
- this . replaceRange ( sourceFile , createTextRange ( insertPos ) , newNode , { indentation, prefix : this . newLineCharacter } ) ;
640
+ this . replaceRange ( sourceFile , createRange ( insertPos ) , newNode , { indentation, prefix : this . newLineCharacter } ) ;
641
641
}
642
642
else {
643
- this . replaceRange ( sourceFile , createTextRange ( end ) , newNode , { prefix : `${ tokenToString ( separator ) } ` } ) ;
643
+ this . replaceRange ( sourceFile , createRange ( end ) , newNode , { prefix : `${ tokenToString ( separator ) } ` } ) ;
644
644
}
645
645
}
646
646
return this ;
@@ -652,7 +652,7 @@ namespace ts.textChanges {
652
652
const [ openBraceEnd , closeBraceEnd ] = getClassBraceEnds ( cls , sourceFile ) ;
653
653
// For `class C { }` remove the whitespace inside the braces.
654
654
if ( positionsAreOnSameLine ( openBraceEnd , closeBraceEnd , sourceFile ) && openBraceEnd !== closeBraceEnd - 1 ) {
655
- this . deleteRange ( sourceFile , createTextRange ( openBraceEnd , closeBraceEnd - 1 ) ) ;
655
+ this . deleteRange ( sourceFile , createRange ( openBraceEnd , closeBraceEnd - 1 ) ) ;
656
656
}
657
657
} ) ;
658
658
}
0 commit comments