VS2010中利用Visual Assist X添加文件头和函数注释

使用菜单项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 String Meaning
$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.

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值