-->

How do I handle TODO comments in VisualStudio 2010

2019-06-19 01:09发布

问题:

I'd like Visual Studio to list all lines having "TODO: " in their beginning (usually after a comment sign which may vary depending on the file type), that can be found in any textual file in a solution (whether it be C#, VB, F#, T-SQL, ASPX, XAML or just TXT) in a special panel showing what's written in the line to the right of "TODO: ", project name (I use many projects in one solution), file name, line number, and code block name (like class and method) if possible.

Do you know of such an extension, or maybe VisualStudio has this feature built-in somewhere? For example, NetBeans sort of has this out-of-the-box.

回答1:

similar here with exemple of how comments must be tagged: http://jack-fx.com/net/2010/01/23/todo-comments-in-visual-studio/



回答2:

Here's how I'm using TODOs in VS as a poor man's issue tracker. Assumes that all my solutions are stored under some folder, let's call it "My Projects".

  1. Open "Find and Replace". Give a code name to "My Projects".
  2. In "Find", add //TODO (or //BUG, or other custom tag)
  3. In "Look In", specify the code name created in #1
  4. In "File types", leave only *.cs files (or wherever you store comments)
  5. Finally, in List results select "Find results 2 window" (in VS Pro or higher, n/a in VS Express)

Simply put, it does a full text search and displays lines with TODOs in a "Find Results 2" window. All you have to do is copy the list and open in your favorite text editor.



回答3:

SQL scripts doesn't support this feature. Please click to upgrade this BUG: https://connect.microsoft.com/VisualStudio/feedback/details/595430/task-list-comment-tasks-dont-show-sql-tasks#details