c++ - 带有 Visual Assist X 和 Doxygen 的 Visual Studio 2012 IntelliSense

标签 c++ visual-studio-2012 intellisense doxygen visual-assist

我曾经以

的风格在我的头文件中写入简单的注释
// 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) { /* ... */ }

令人惊讶的是,当悬停此功能或获取视觉辅助“IntelliSense”时,我会得到两个不同的输出。将鼠标悬停在 Replace 上会产生

Hover ToolTip

虽然提到的 IntelliSense 产生了

enter image description here

但是将 Doxygen 风格的注释移动到标题中会产生奇怪的结果

enter image description here

我想知道您是否有建议如何使用 Qt 样式的 doxygen 注释,但让 IntelliSense 显示适当的工具提示(无论它是什么),而不是根据我调用它的方式显示不同的工具提示? 必须有一种方法来统一这一点。(或者我必须像往常一样工作并创建单独的文档标题,其中仅包含 doxygen 注释 - 这样我不会有问题但会有冗余数据)

最佳答案

我看到的唯一简单(但丑陋)的方法是添加一些预处理器指令以使 Visual Studio 忽略它

#if 0
/*! your comment
*/
#endif

您可能想在#endif 之后添加一些内容,这样您就可以轻松地通过研究将其删除并进行替换,而无需删除您需要的内容。至少在 VS2013 中它很好地忽略了 #if 0 block 。 有了这个,您应该能够将它们留在同一个文件中,这样就不会那么痛苦了。

关于c++ - 带有 Visual Assist X 和 Doxygen 的 Visual Studio 2012 IntelliSense,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15786595/

相关文章:

c++ - 结构数组有什么问题?

.net - Azure 中不健康的实例

javascript - 用于 Backbone.js 的 Visual Studio Intellisense

vb.net - Windows 服务 - 创建安装程序 Visual Studio 2012 如何?

c# - Resharper 代码完成工具提示未显示

visual-studio-2010 - Visual Studio 2010 Intellisense卡住

c++ - Qt:如何使用 registerField() 在 QWizardPages 之间传递变量值

c++ - 在 C++ 中,可迭代类型应该是非多态的吗?

c++ - 如何推断 lambda 的返回类型?

visual-studio-2012 - Visual Studio 2012 - "Show Table Data"缺失