Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Indentation in Surrond comments
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

imtrobin
Ketchup Master

50 Posts

Posted - Jan 30 2004 :  09:56:39 AM  Show Profile
Hi,

I like to suggest that when surrounding the code with // to turn into comments, indent the // to the current indentation level too.

e.g
void Foo
{
F();
}

to

void Foo
{
// F();
}

Stephen
Tomato Guru

United Kingdom
781 Posts

Posted - Jan 30 2004 :  12:04:02 PM  Show Profile
Your example didn't come out right, but I agree with your point. It's related to this bug: http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=1075

Stephen Turner
ClickTracks http://www.clicktracks.com/
Winner: ClickZ's Best Web Analytics Tool 2003 & 2004
Go to Top of Page

LarryLeonard
Tomato Guru

USA
1041 Posts

Posted - Jan 30 2004 :  12:14:30 PM  Show Profile
FYI, if you use the "Insert code" (crosshatch/pound sign/octothorpe/hash/square) button, it will work:


void Foo
{
     // F();
}

Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Jan 30 2004 :  3:13:47 PM  Show Profile
Stephen's reference still applies. Things get complicated if VA X does more than the simple inserting and removing of // at the beginning of lines.

Even if / uncommented lines that are indented and commented, would / on a line with no comments indent? One could argue the slashes would go at the front, another would argue they get indented.

Whole Tomato Software, Inc.
Go to Top of Page

WannabeeDeveloper
Tomato Guru

Germany
775 Posts

Posted - Jan 30 2004 :  3:58:19 PM  Show Profile
Why not making it an option then? So anyone can select which suits him better...

Like a "Indent Comments" in VA X Options...

Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Jan 30 2004 :  7:41:50 PM  Show Profile
We knew someone would ask for the option.

We get nervous every time we add a feature not associated with our core technology, ie of fixing Intellisense. Well, we guess we have strayed from that far too many times to use that excuse any more.

We will consider the option, though do not expect it soon. We are quite busy fixing bugs.

Whole Tomato Software, Inc.
Go to Top of Page

imtrobin
Ketchup Master

50 Posts

Posted - Feb 01 2004 :  01:46:31 AM  Show Profile
Great. I have a "solution" to solving the problem.

I use a separate AddComment, RemoveComment macro script to do this. AddComment will add a level of indentation comment to selected text while RemoveComment will remove a level of indentation. I use only //, no /**/ as the latter doesn't work well when I have to comment large chunks of already commented out code.

The reason I would like VA to have this too is because the VS macros are slow.


 ''' CommentRegion puts line-oriented comment syntax at the beginning
    ''' of every line the selection touches and creates an undo so that
    ''' there is only one undo action for all the lines edited.

    Sub CommentRegion()
        Dim selection As TextSelection = DTE.ActiveDocument.Selection()
        Dim start As EditPoint = selection.TopPoint.CreateEditPoint()
        Dim endpt As TextPoint = selection.BottomPoint
        Dim commentStart As String = LineOrientedCommentStart()

        start.StartOfLine()

        Dim bUndo As Boolean = Not DTE.UndoContext.IsOpen()

        If bUndo Then
            DTE.UndoContext.Open("Comment Region")
        End If

        Try
            Do While (start.LessThan(endpt))
                start.Insert(commentStart)
                start.LineDown()
                start.StartOfLine()
            Loop

            selection.SmartFormat()

        Finally

            'If an error occured, then need to make sure that the undo context is cleaned up.
            'Otherwise, the editor can be left in a perpetual undo context
            If bUndo Then
                DTE.UndoContext.Close()
            End If

        End Try
    End Sub


 ' Uncomment code
    Sub UncommentRegion()

        Dim selection As TextSelection = DTE.ActiveDocument.Selection()

        Dim bUndo As Boolean = Not DTE.UndoContext.IsOpen()

        If bUndo Then
            DTE.UndoContext.Open("UnComment Region")
        End If

        Try
            DTE.ExecuteCommand("Edit.UncommentSelection")
            selection.SmartFormat()
        Finally

            'If an error occured, then need to make sure that the undo context is cleaned up.
            'Otherwise, the editor can be left in a perpetual undo context
            If bUndo Then
                DTE.UndoContext.Close()
            End If

        End Try

    End Sub

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000