@@ -276,7 +276,7 @@ private void RenameControl()
276
276
var module = handler . Project . VBComponents . Item ( handler . ComponentName ) . CodeModule ;
277
277
278
278
var content = module . Lines [ handler . Selection . StartLine , 1 ] ;
279
- var newContent = GetReplacementLine ( content , handler . IdentifierName , newMemberName , handler . Selection ) ;
279
+ var newContent = GetReplacementLine ( content , newMemberName , handler . Selection ) ;
280
280
module . ReplaceLine ( handler . Selection . StartLine , newContent ) ;
281
281
}
282
282
@@ -308,7 +308,7 @@ private void RenameUsages(Declaration target, string interfaceName = null)
308
308
var module = member . Project . VBComponents . Item ( member . ComponentName ) . CodeModule ;
309
309
310
310
var content = module . Lines [ member . Selection . StartLine , 1 ] ;
311
- var newContent = GetReplacementLine ( content , member . IdentifierName , newMemberName , member . Selection ) ;
311
+ var newContent = GetReplacementLine ( content , newMemberName , member . Selection ) ;
312
312
module . ReplaceLine ( member . Selection . StartLine , newContent ) ;
313
313
RenameUsages ( member , target . ComponentName ) ;
314
314
}
@@ -334,12 +334,12 @@ private void RenameUsages(Declaration target, string interfaceName = null)
334
334
335
335
if ( interfaceName == null )
336
336
{
337
- newContent = GetReplacementLine ( content , target . IdentifierName , _view . NewName ,
337
+ newContent = GetReplacementLine ( content , _view . NewName ,
338
338
reference . Selection ) ;
339
339
}
340
340
else
341
341
{
342
- newContent = GetReplacementLine ( content , target . IdentifierName ,
342
+ newContent = GetReplacementLine ( content ,
343
343
interfaceName + "_" + _view . NewName ,
344
344
reference . Selection ) ;
345
345
}
@@ -363,22 +363,17 @@ private void RenameUsages(Declaration target, string interfaceName = null)
363
363
}
364
364
365
365
var content = module . Lines [ method . Selection . StartLine , 1 ] ;
366
- var newContent = GetReplacementLine ( content , oldMemberName , newMemberName , member . Selection ) ;
366
+ var newContent = GetReplacementLine ( content , newMemberName , member . Selection ) ;
367
367
module . ReplaceLine ( method . Selection . StartLine , newContent ) ;
368
368
}
369
369
}
370
370
}
371
371
}
372
372
373
- private string GetReplacementLine ( string content , string target , string newName , Selection selection )
373
+ private string GetReplacementLine ( string content , string newName , Selection selection )
374
374
{
375
- // until we figure out how to replace actual tokens,
376
- // this is going to have to be done the ugly way...
377
-
378
- // todo: come back after the identifier references are fixed
379
- //var contentWithoutOldName = content.Remove(selection.StartColumn - 1, selection.EndColumn - selection.StartColumn);
380
- //return contentWithoutOldName.Insert(selection.StartColumn - 1, newName);
381
- return Regex . Replace ( content , "\\ b" + target + "\\ b" , newName ) ;
375
+ var contentWithoutOldName = content . Remove ( selection . StartColumn - 1 , selection . EndColumn - selection . StartColumn ) ;
376
+ return contentWithoutOldName . Insert ( selection . StartColumn - 1 , newName ) ;
382
377
}
383
378
384
379
private string GetReplacementLine ( CodeModule module , Declaration target , string newName )
@@ -459,7 +454,7 @@ private string GetReplacementLine(CodeModule module, Declaration target, string
459
454
460
455
return rewriter . GetText ( new Interval ( firstTokenIndex , lastTokenIndex ) ) ;
461
456
}
462
- return GetReplacementLine ( content , target . IdentifierName , newName , target . Selection ) ;
457
+ return GetReplacementLine ( content , newName , target . Selection ) ;
463
458
}
464
459
465
460
private static readonly DeclarationType [ ] ProcedureDeclarationTypes =
0 commit comments