Visual Studio 2012结合Visual Assist X和Doxygen的智能感知功能

5

我曾经以以下的方式在我的头文件中写简单的注释:

// Returns a new string in which all occurrences of a specified string in the
// current instance are replaced with another specified string.
// - strSubject: The string to perform the replacement on.
// - strOldValue: The string to be replaced.
// - strNewValue: The string to replace all occurrences of strOldValue.
static RUNTIME_API String::type Replace
    (_In_       String::type  strSubject,
     _In_ const String::type& strOldValue,
     _In_ const String::type& strNewValue);

希望Visual Assist能够准确显示我这个注释:

IntelliSense

目前,我正在考虑使用Doxygen为项目创建文档,但我在寻找正确显示在工具提示中并可被Doxygen解析的文档样式方面遇到了困难。首先,我考虑在*.cpp文件中包含Doxygen风格的注释,以便只显示标题注释。因此,在我的源文件中,我有一个类似于以下的注释:

/*!
 * Returns a new string in which all occurrences of a specified string in the
 * current instance are replaced with another specified string.
 *
 * \param   strSubject  The string to perform the replacement on.
 * \param   strOldValue The string to be replaced.
 * \param   strNewValue The string to replace all occurrences of strOldValue.
 * 
 * \return  A string that is equivalent to the current string except that all
 *          instances of strOldValue are replaced with strNewValue. If
 *          strOldValue is not found in the current instance, the method returns
 *          the current instance unchanged.
 */
String::type String::Replace
    (_In_       String::type  strSubject,
     _In_ const String::type& strOldValue,
     _In_ const String::type& strNewValue) { /* ... */ }

令人惊讶的是,在悬停此功能时或获取Visual Assists“IntelliSense”时,我会得到两个不同的输出。悬停Replace会产生如下结果: Hover ToolTip 而所提到的IntelliSense则产生以下结果: enter image description here 然而,将Doxygen样式的注释移入标题中却有一个奇怪的结果: enter image description here 我想知道您是否有建议,如何使用Qt样式的doxygen注释,但仍能让IntelliSense显示相应的工具提示(无论它是哪一个),而不是根据我如何调用它而显示不同的工具提示?必须有一种方法来统一这一切。(或者我要像往常一样工作,并创建仅由doxygen注释组成的单独文档头文件-这样我就不会遇到问题,但会有冗余数据)

我向Whole Tomato提交了一个关于类似问题的支持请求,他们说他们可以重现并提交了一个错误报告。不知道这个问题何时会得到解决。我尝试了Visual Assist与VS 2013的当前最新版本。 - Massimiliano
1个回答

0
我所看到的唯一简单(但不美观)的方法是添加一些预处理指令,使Visual Studio忽略它。
#if 0
/*! your comment
*/
#endif

你可能想在 #endif 后面添加一些内容,这样你就可以轻松地使用查找和替换功能将其删除,而不会删除你需要的部分。至少在 VS2013 中,它可以很好地忽略 #if 0 块。 有了这个方法,你应该能够将它们留在同一个文件中,这样就不那么麻烦了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接