开发者

Is there a nice way to display long XML comments in Visual Studio without navigating to the definition?

开发者 https://www.devze.com 2023-03-10 11:04 出处:网络
The tooltips which show the comments are handy, but for long comments, the tooltip becomes useless because it only lasts a few seconds, and the comment is stretched along a single line until it runs o

The tooltips which show the comments are handy, but for long comments, the tooltip becomes useless because it only lasts a few seconds, and the comment is stretched along a single line until it runs off the end.

It's possible to get to the comments by navigating to the definition, 开发者_如何学Gobut this is annoying because it opens tabs to source files which I am not working on, and messes up the forward/back navigation history. It also suffers from the issue that you are looking at XML (which must be escaped), instead of nicely formatted documentation.

What I'd really like to see is something like how Eclipse displays javadoc comments. This blog post shows a comparison for tooltips of similar classes in Visual Studio and Eclipse.

Does such a mode or plugin exist for Visual Studio?


You can put your xml comments on multiple lines with the <para> tag. This way your long comments won't run off the edge of your screen:

/// <summary>
/// <para>First line of your comment</para>
/// <para>Second line of your comment</para>
/// </summary>

About the delay for those tooltips; this has been a long running request for Visual Studio, which still hasn't been fixed. Most recently requested here, and even back in 2004, here.


I use GhostDoc for automatically generating XML comments on my code, this is particularly useful as you don't spend too much time re-generating the comments and it helps make the API info consisient.

A couple of idea's:

You could use a hyperlink in a comment as pictured below. This could point to a help-system:

Is there a nice way to display long XML comments in Visual Studio without navigating to the definition?

You could use this in conjunction with SandCastle, here is a great article Creating documentation for a Net component with Sandcastle Help File Builder:

The creation of an XML file from the comments is disabled by default. It should be enabled in the project properties on Build tab.

Is there a nice way to display long XML comments in Visual Studio without navigating to the definition?

As a result, an XML file will be created upon each build of your executable or assembly. That file will contain all the XML comments from the code, including comments for all non-public entities. This file is useful in itself because when you put it next to the assembly, the IntelliSense feature in Visual Studio will use information from this file to display descriptions for the methods, properties and parameters of the assembly. Here is an example of how it will look for a function GetR shown above:

Is there a nice way to display long XML comments in Visual Studio without navigating to the definition?

0

精彩评论

暂无评论...
验证码 换一张
取 消