0

Feel free to massively re-word this question.

Basically, I'm currently stripping out a huge portion of a very large framework - this involves A LOT of commenting. So I can find all of this later I am batch commenting and then copy-pasting a marker before each block that is something like this:

//MYINITIALS_REMOVE
/*if (this code is rubbish)
{
    comment it out;
}*/

I'd like to create a function so that with one button press or key combination I batch comment out selected code and automatically place my tag at the beginning. So instead of the opening comment being '//' or '/*' it is 'MYINITIALS_REMOVE//' or 'MYINITIALS_REMOVE/*'

Is this possible?

EDIT Actually thinking about it, I wouldn't even mind if every single line began with 'MYINITIALS_REMOVE//'.

Dollarslice
  • 9,917
  • 22
  • 59
  • 87

1 Answers1

0

I think you are looking for this:

Public Sub CStyleComment()
    Dim selection As TextSelection = DTE.ActiveDocument.Selection
    selection.TopPoint.CreateEditPoint.Insert("//MYINITIALS_REMOV" & vbCrLf & "/*")
    selection.BottomPoint.CreateEditPoint.Insert("*/")
End Sub

Maybe this version is more suitable (automatic translation):

Public Sub CStyleComment()
    Dim selection As TextSelection = DTE.ActiveDocument.Selection
    selection.TopPoint.CreateEditPoint.Insert("//MYINITIALS_REMOV" & vbCrLf & "/*")
    selection.BottomPoint.CreateEditPoint.Insert("*/")
End Sub
IvanH
  • 5,039
  • 14
  • 60
  • 81