【Visual Studio】VS2012中利用Visual Assist X添加文件头和函数注释

来源:互联网 发布:指南针软件卸载 编辑:程序博客网 时间:2024/05/15 08:31

http://panghuli.me/?p=2002

使用菜单项VAssistX -> Insert VA Snippets会弹出菜单,显示可以插入的各种VA脚本。或者右击函数名,然后依次点击“Refacto”–>“Document Method”,可以插入函数头注释。

但是这个注释格式是默认的,可能不适合你的项目。可以在VAssistX的选项中更改显示样式,在VS2008中点击 “VAssistX”–>”Visual VAssistX Options”然后选择Suggestions,再点击”Edit VA Snippets”。在打开的窗口中选择File Head Detailed和Refactor Document Method,在这就可以更改你的文件头和函数头的显示样式了。

1/********************************************************************
2 Copyright (C), 2012-2013,
3 FileName: $FILE_BASE$.$fILE_EXT$
4 Description:
5 Author: $Author$
6 Created: $DATE$
7 history: $DAY$:$MONTH$:$YEAR$ $HOUR$:$MINUTE$ by
8 
9*********************************************************************/

 

1//************************************
2// Method: $SymbolName$
3// Access: $SymbolVirtual$$SymbolPrivileges$$SymbolStatic$
4// Returns: $SymbolType$
5// Qualifier: $MethodQualifier$
6// Parameter: $MethodArg$
7// Author: $Author$
8// History:
9//************************************

另外可参考官方文档:

Document Method

Refactoring with Document Method is a simple way of adding a comment block prior to a method. Components of the method, e.g. return value and parameters, are listed on separate lines of the block so you can document their meanings individually.

Hover over the declaration or implementation of a method and select Document Method from the refactoring menu.

A comment block is created prior to the method.

Format of Comment Block

You can modify the format of comment block by editing the VA Snippet for Refactor Document Method. There are separate VA Snippets for C++, C# and VB.

The VA Snippets entries include special characters expanded only when refactoring. These special characters are:

Reserved StringMeaning$SymbolName$Name of method$SymbolContext$Context and name of method$SymbolType$Return type of method$SymbolVirtual$Keyword virtual or blank$SymbolPrivileges$Access of method$SymbolStatic$Keyword static or blank$MethodQualifier$Qualifier or blank$MethodArg$One parameter of the method and its type$MethodArgName$One parameter of the method$MethodArgType$Type of one parameter of the method

The line of the VA Snippets entry containing $MethodArg$ or $MethodArgName$ is repeated for each parameter of the method.

If you delete a VA Snippets entry and invoke Document Method, a default entry is created for you.


0 0
原创粉丝点击