Visual Studio XML摘要注释在单行

编程入门 行业动态 更新时间:2024-10-24 02:27:38
本文介绍了Visual Studio XML摘要注释在单行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在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="schemas.microsoft/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摘要注释在单行

本文发布于:2023-11-13 00:56:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582969.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:注释   摘要   Visual   Studio   XML

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!