@@ -1053,7 +1053,7 @@ namespace ts.refactor.extractSymbol {
1053
1053
changeTracker . insertNodeBefore ( context . file , nodeToInsertBefore , newVariable , /*blankLineBetween*/ true ) ;
1054
1054
1055
1055
// Consume
1056
- changeTracker . replaceRange ( context . file , { pos : node . getStart ( ) , end : node . end } , localReference ) ;
1056
+ changeTracker . replaceNode ( context . file , node , localReference , textChanges . useNonAdjustedPositions ) ;
1057
1057
}
1058
1058
else {
1059
1059
const newVariableDeclaration = createVariableDeclaration ( localNameText , variableType , initializer ) ;
@@ -1070,15 +1070,15 @@ namespace ts.refactor.extractSymbol {
1070
1070
1071
1071
// Consume
1072
1072
const localReference = createIdentifier ( localNameText ) ;
1073
- changeTracker . replaceRange ( context . file , { pos : node . getStart ( ) , end : node . end } , localReference ) ;
1073
+ changeTracker . replaceNode ( context . file , node , localReference , textChanges . useNonAdjustedPositions ) ;
1074
1074
}
1075
1075
else if ( node . parent . kind === SyntaxKind . ExpressionStatement && scope === findAncestor ( node , isScope ) ) {
1076
1076
// If the parent is an expression statement and the target scope is the immediately enclosing one,
1077
1077
// replace the statement with the declaration.
1078
1078
const newVariableStatement = createVariableStatement (
1079
1079
/*modifiers*/ undefined ,
1080
1080
createVariableDeclarationList ( [ newVariableDeclaration ] , NodeFlags . Const ) ) ;
1081
- changeTracker . replaceRange ( context . file , { pos : node . parent . getStart ( ) , end : node . parent . end } , newVariableStatement ) ;
1081
+ changeTracker . replaceNode ( context . file , node . parent , newVariableStatement , textChanges . useNonAdjustedPositions ) ;
1082
1082
}
1083
1083
else {
1084
1084
const newVariableStatement = createVariableStatement (
@@ -1097,11 +1097,11 @@ namespace ts.refactor.extractSymbol {
1097
1097
// Consume
1098
1098
if ( node . parent . kind === SyntaxKind . ExpressionStatement ) {
1099
1099
// If the parent is an expression statement, delete it.
1100
- changeTracker . deleteRange ( context . file , { pos : node . parent . getStart ( ) , end : node . parent . end } ) ;
1100
+ changeTracker . deleteNode ( context . file , node . parent , textChanges . useNonAdjustedPositions ) ;
1101
1101
}
1102
1102
else {
1103
1103
const localReference = createIdentifier ( localNameText ) ;
1104
- changeTracker . replaceRange ( context . file , { pos : node . getStart ( ) , end : node . end } , localReference ) ;
1104
+ changeTracker . replaceNode ( context . file , node , localReference , textChanges . useNonAdjustedPositions ) ;
1105
1105
}
1106
1106
}
1107
1107
}
0 commit comments