Visual Studio XML摘要注释在单行 [英] Visual Studio XML summary comment on single line
问题描述
在Visual Studio中,如何将默认的XML摘要注释片段从三行改为一行?
In Visual Studio, how do I change the default XML summary comment snippet from three lines to one line?
目前它提供了这个片段,当我键入 /// :
Currently it provides this snippet when I type ///
:
/// <summary>
///
/// </summary>
我想要这个较短的代码段:
I would like this shorter snippet:
///<summary></summary>
我的摘要通常很简短,不需要额外的2行。
My summaries are often brief and the extra 2 line are unnecessary.
有这个或一些可自定义的代码/自定义插件的配置设置来修复此问题。
Is there a configuration setting for this or some customizable code/custom addon to fix this.
推荐答案
这是一个较老的问题,但我喜欢Jason Williams的建议,为此创建一个片段,所以我做了。不太复杂,但复制和粘贴更容易:)
This is an older question, but I liked Jason Williams's suggestion of creating a snippet for this, so I did. Not very complicated, but copy-and-paste is even easier :)
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Single line summary</Title>
<Shortcut>summary</Shortcut>
</Header>
<Snippet>
<Code Language="csharp">
<![CDATA[/// <summary>$end$</summary>]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
您可以更改快捷方式(可能显然)更改< Shortcut> ;
You can change the shortcut by (probably obviously) changing the <Shortcut>
value.
将它粘贴到名为 SingleLineSummary.snippet
的新文件中,并保存它位于文件夹%USERPROFILE%\Documents\Visual Studio 2012 \Code Snippets \Visual C#\ My Code Snippets
中(修改以适合您的Windows版本和Visual Studio)。
Paste that into a new file named SingleLineSummary.snippet
and save it in the folder %USERPROFILE%\Documents\Visual Studio 2012\Code Snippets\Visual C#\My Code Snippets
(modify to fit your version of Windows and Visual Studio).
如果你不熟悉代码片段,使用这个只是把光标放在一个方法/属性/ etc上,开始键入 summary
,然后点击TAB几次。
If you're not familiar with snippets, to use this just put the cursor above a method/property/etc, start typing summary
, and then hit TAB a couple of times.
这篇关于Visual Studio XML摘要注释在单行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!