Visual-Studio-2010 – Extension to attach the username and date to Visual Studio 2010 Code Notes

Is there an extension for Visual Studio 2010 that allows you to insert comments and automatically append your username and current date:

/ / You type comments here [by Toni, on 03/26/2011]

This will help us maintain a uniform comment format in our solution.

Edit: This question is not about VCS, I know you can add and execute comments there. I am just looking for a Visual Studio 2010 Client solution!

I tend to agree that snowbear tracks who has written what code in source control. For some reason it makes more sense for your team to add comments to the code, then you might just create a visual studio macro and bind it to a hotkey. Something like the following should be enough:

Sub TaggedComment()
DTE.ActiveDocument.Selection.Text = "// [by "
DTE.ActiveDocument.Selection.Text = Environment. UserName
DTE.ActiveDocument.Selection.Text = ", on "
DTE.ActiveDocument.Selection.Text = DateTime.Now.Date.ToShortDateString
DTE.ActiveDocument.Selection.Text = "] "
DTE.ActiveDocument.Selection.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
DTE.ActiveDocument.Selection.CharRight(False, 3)
End Sub

Or you can Consider creating a Code Snippet (this seems to be a higher performance solution).

Is there a Visual Studio 2010 extension that allows you to insert comments and automatically append your username and Current date:

// You type comments here [by Toni, on 03/26/2011]

This will help us Maintain a unified comment format in our solution.

Edit: This question is not about VCS, I know you can add and execute comments there. I’m just looking for a Visual Studio 2010 Client solution !

I tend to agree that snowbear tracks who wrote what code in source control. If for some reason your group makes more sense in the code Add a comment in, then you may just create a visual studio macro and bind it to a hotkey. Something like the following should be enough:

< pre>Sub TaggedComment()
DTE.ActiveDocument.Selection.Text = “// [by “
DTE.ActiveDocument.Selection.Text = Environment.UserName
DTE.ActiveDocument.Selection.Text = “, on “
DTE.ActiveDocument.Selection.Text = DateTime.Now.Date.ToShortDateString
DTE.ActiveDocument.Selection.Text = “]”
DTE.ActiveDocument.Selection.StartOfLine (vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
DTE.ActiveDocument.Selection.CharRight(False, 3)
End Sub

Alternatively, you can consider creating a Code Snippet (this seems to be a higher performance Solution).

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1968 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.