visual-studio 如何处理 VisualStudio 2010 中的 TODO 注释?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2823875/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 11:58:04  来源:igfitidea点击:

How do I handle TODO comments in VisualStudio 2010?

visual-studiovisual-studio-2010commentstodo

提问by Ivan

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.

我希望 Visual Studio 列出所有以“TODO:”开头的行(通常在注释符号之后,该符号可能因文件类型而异),可以在解决方案的任何文本文件中找到(无论是 C# 、VB、F#、T-SQL、ASPX、XAML 或仅 TXT)在一个特殊面板中显示“TODO:”右侧行中的内容、项目名称(我在一个解决方案中使用多个项目)、文件名、如果可能,行号和代码块名称(如类和方法)。

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.

你知道这样的扩展吗,或者 VisualStudio 在某处内置了这个功能?例如,NetBeans 有这种开箱即用的功能。

回答by Patrik Lindstr?m

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

与如何标记评论的示例类似:http: //Hyman-fx.com/net/2010/01/23/todo-comments-in-visual-studio/

回答by SUVer

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".

这是我如何在 VS 中使用 TODO 作为穷人的问题跟踪器。假设我所有的解决方案都存储在某个文件夹下,我们称之为“我的项目”。

  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)
  1. 打开“查找和替换”。给“我的项目”一个代号。
  2. 在“查找”中,添加//TODO(或//BUG,或其他自定义标签)
  3. 在“Look In”中,指定在#1 中创建的代码名称
  4. 在“文件类型”中,只留下 *.cs 文件(或您存储评论的任何地方)
  5. 最后,在 List results 中选择“Find results 2 window”(在 VS Pro 或更高版本中,在 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.

简而言之,它执行全文搜索并在“查找结果 2”窗口中显示包含待办事项的行。您所要做的就是复制列表并在您喜欢的文本编辑器中打开。