如何调和对Visual Studio注释的期望和具有DOORGORY注释的代码?

人气:268 发布:2022-10-16 标签: xml comments visual-studio tooltip doxygen

问题描述

为DOOXY处理编写的代码具有这样的行是正常的。

int myVariable; ///< description of myVariable

但是,当Visual Studio(例如,VS 2015)使用用这些Doxo注释准备的代码时,其myVariable的工具提示信息将显示

XML comment contains invalid XML: Whitespace is not allowed at this location.

问题似乎是紧跟在"/"之后的"<;"。这似乎被Visual Studio解释为发送信号(格式不正确)的XML内容。但是,此组合与"<;"一起出现,表示该注释适用于该行上的前一项,而不是后一项。

假设我们谈论的是一个已经遵循这个DOXORT约定的现有代码体。很多地方已经这样写了。

是否有办法调整、示教或设置Visual Studio,使其将此类注释视为前一项的常规文档注释,以便它们将显示在这些项的工具提示中?

推荐答案

DOOXO有不同的注释样式(请参阅手册中关于"特殊注释块"的部分,在本例中是关于"将文档放在成员之后"的段落。 我们在这里看到了可能性:

int var; /**< Detailed description after the member */
or
int var; //!< Detailed description after the member
//!<
or
int var; ///< Detailed description after the member

在这种情况下,我们可以从///<切换到//!<

918