Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add a note to a Visual Studio bookmark or line?

When I am in the middle of debugging I often find more than one area that can be improved (or fixed) and I like to mark them in such away that I can come back later and make the improvement.

Currently I add a bookmark to the line but this can't include any notes that can be used to remind me why the bookmark was there (you can change the name of the bookmark but this isn't enough). I suppose I really want to be able to add a TODO to the code while the code is running but although Edit and Continue is enabled it is not available in the ASP.NET WebForms (3.5) project.

Are there any Visual Studio features or extensions that will enable this?

like image 999
Keith K Avatar asked Feb 20 '13 13:02

Keith K


People also ask

How do I add a note in Visual Studio?

Type /// in C#, or ''' in Visual Basic. From the Edit menu, choose IntelliSense > Insert Comment.

How do I bookmark a line in Visual Studio?

To bookmark a line of code, place the cursor on the the line of code you intend to bookmark and use the Toggle Bookmark icon in the bookmark window. Another quick way to bookmark code is to use the keyboard shortcut Ctrl+K, Ctrl+K.


2 Answers

Instead of enabling Edit and Continue then entering a TODO: into the source code, you can create a Task List Shortcut (key cord Ctrl + K, Ctrl + H).

This adds an entry to the Shortcuts section of the Task List window. From there you can change the description of the task to remind you why you created it.

like image 193
Keith K Avatar answered Sep 28 '22 02:09

Keith K


Due to the fact the answer marked as accepted has been deprecated in VS 2015 onwards, I used this solution instead:

Bookmark a line of code using the key cord Ctrl+K Ctrl+K, then open the Bookmarks window (Ctrl+K Ctrl+W). In the Bookmarks window you can rename your bookmarks to whatever you please.

I have tested this in both VS 2015 and 2017 (Community).

IMPORTANT NOTE: Make sure to File->Save All (Ctrl+Shift+S) every once in a while so you don't lose the bookmarks you've been working on if VS or Windows decide to crash. I have fallen victim to this and it is painful.

like image 42
Mohammed Arabiat Avatar answered Sep 28 '22 02:09

Mohammed Arabiat