How to modify the Code Comment Symbol

How do you modify the visual studio 2005 visual basic code comment symbol so that the ide will insert "continuous" apostrophes rather than 2 apostrophes and a space and 2 apostrophes and a space ...ad infinitum Visual Studio 2003 visual basic inserted consectutive apostrophes without any intermediate spaces !!!!

e.g. what it does now (inserts a space after 2 apostrophes VB2005)

' ' ' 'code line 1
' ' ' 'code line 2

e.g. what I want it to do ( does not insert spaces after any apostrophes VB2003)

' ' ' 'code line 1
' ' ' 'code line 2



Answer this question

How to modify the Code Comment Symbol

  • KC sharad

    This behavior is by design in VB 2005.  If you convert to a comment via the command, then again, and then again, we need to insert a space, because otherwise the three single-quotes would be adjacent and we'd infer an XML comment.  There  is no way to modify this.  I wouldn't want to add an option because, frankly, we already have quite enough options.

    However, JoeCodester, I definitely like your suggestion up above better -- I think we should just always insert a space when we execute the comment command.  It would look a lot better (instead of what to my eye look like little footprints all over the line), and I think even when commenting only once I'd prefer the comment mark not to be right next to whatever I'm commenting anyway.  The downside is that it uses up a little more horizontal whitespace (but how many times would you expect to call the command anyway, right ).  I'll pass this suggestion along to the program manager for that feature.

    (Edit:  I *think* you're suggesting what I just said, right   Upon re-reading your comment at the top, I'm not quite sure, given the comment on VS2003.  We definitely (alas) can't have them adjacent in VS2005 or later without white spaces because of XML commenting...)



  • Dave Koehler

    Matt

    How about a compromise -

    When I select a single or multiple lines ....

    1.) begin the apostrophes at the left margin (VB6) rather than at begining of the first character in the line - this allows all comment symbols

    to be horizontally together

    2.) then insert a space between each comment apostrophe so that it doesn't enter an xml comment -

    3.) allow the above to be an option you can customize the comment tool with - so that others who could care less are still allowed

    the current method ..

    Please advise

    Thanks

    Joe

    Question - is there a way to post screen shots of my examples


  • ZZhang

    I could not find an option that would effect this behavior....in my VS05 VB IDE i get consecutive apostrophees and all other key strokes...

     

    edit...3 consecutive apostrophees prior to a declaration gives the xml comments



  • Raghuraman_ace

    Joe,

    This is a strange one then...because I just checked my version and it is EXACTLY the same version..

    Microsoft Visual Studio 2005
    Version 8.0.50727.42 (RTM.050727-4200)
    Microsoft .NET Framework
    Version 2.0.50727
    Installed Edition: Professional

    And...I'm not having that problem nor am I able to recreate it

    Public Class Form1

    '''''''''''''''''''''''

    ''' <summary>

    '''

    ''' </summary>

    ''' <param name="sender"></param>

    ''' <param name="e"></param>

    ''' <remarks></remarks>

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim ctrl As Control

    For Each ctrl In Me.TabPage1.Controls

    Dim NewCtrl As New Control

    Dim CtrlType As String = ctrl.GetType().ToString

    MessageBox.Show(CtrlType)

    Select Case CtrlType

    Case Is = "TextBox"

    ''''''''''''''''''''test

    '''''''''''''''''test

    'make spaces'' '' '' '' ' ' '

    ''''''''''''''''''''''''''''''''

    End Select

    Next

    End Sub

    ''' <summary>

    ''' '''''''''''

    ''' </summary>

    ''' <param name="sender"></param>

    ''' <param name="e"></param>

    ''' <remarks></remarks>



  • SoulSolutions

    Hi, Joe,

    Just to set expectations, nothing regarding commenting is likely to change for the version we're currently working on (as my compiler/editor team is deeply engaged on The Feature That Ate Our Lives, i.e. LINQ which, while being very cool, is nevertheless going to take us right to the wire for this product cycle). For future versions, nothing is off the table, and I will add your suggestion to my collection of Things To Discuss when we start planning.

    (To answer your other question -- I'm not aware of any way to post pictures to this forum. But if you want to point us at a website you own, we'd definitely take the time to look at screenshots that you feel are relevant.)

    --Matt--*



  • huysmans

    Dman1
    Microsoft Visual Studio 2005
    Version 8.0.50727.42 (RTM.050727-4200)
    Microsoft .NET Framework
    Version 2.0.50727
    Installed Edition: Professional

    I walked around various local cubes and all vb2005 users exhibit 2 apostrophes a space and
    then it repeats ....
    Note -
    1.) if you press apostrophe 3 times on a line above the function or sub you get the <summary> xml etc.
    2.) if you insert a text line above/below a function/sub ...then select it...and press the comment
    tool 6 times, you will get 2 apostrophes, a space and then 2 apostrophes, ad infinitum

    Note - we persist a lot of code history in our comments and have been using a block of consecutive apostrophes followed by a block of consecutive spaces to separate out various revisions....
    so that if you had 3 revisions on a particular multiple line code section, you would have
    a stair stepping arrangement of the followign

    '---------------------------------------------------
    '2006_1110_0900.begin
    ''''''''2005_1101_0852.begin(a date has 1 additional apostrophe)
    ''''''''old
    ''''''' '''''''''original comments on code (a comment has 1 additional apostrophe)
    ''''''' ''''''''original code line #1
    ''''''' ''''''''original code line #2
    ''''''''new
    ''''''''comment's on revision #1 (a comment has 1 additional apostrophe)
    '''''''first revision code line #1
    '''''''first revision code line #2
    ''''''''2005_1101_0852.end(a date has 1 additional apostrophe)

    'comments on revision #2 (a comment has 1 additional apostrophe)
    second revision code line #1
    second revision code line #2
    '2006_1110_0900.end (a date has 1 additional apostrophe)
    '---------------------------------------------------

    The new commenting tool commpletely mangles this ability for all code prior to VB2005 and
    continuing to use this method from now on !!!!!

    Please research further .....it's a major headache - thanks!!


  • Hatzi74

    DMAN1

    Are you selecting multiple lines at once and then clicking the comment button


  • zaboboa

    JoeCodester wrote:

    DMAN1

    Are you selecting multiple lines at once and then clicking the comment button

    No I'm manually typing apostrophees



  • How to modify the Code Comment Symbol