如何协调 Visual Studio 注释期望与具有 Doxygen 注释的代码?
How to reconcile Visual Studio comment expectations with code having Doxygen comments?
为 Doxygen 处理编写的代码有这样的行是正常的。
int myVariable; ///< description of myVariable
但是,当 Visual Studio(例如 VS 2015)使用这些 Doxygen 注释准备的代码时,其 myVariable
的工具提示信息将显示
XML comment contains invalid XML: Whitespace is not allowed at this location.
问题似乎是紧跟在“///”之后的“<”。这似乎被 Visual Studio 解释为信号(格式不正确)XML 内容。但是,此组合与“<”一起出现,以向 Doxygen 发出信号,表明注释适用于行中的前一项,而不适用于后一项。
假设我们正在讨论已经遵循此 Doxygen 约定的现有代码体。很多地方已经这样写了
有没有办法调整或教导或设置 Visual Studio 以便它将此类评论视为前面项目的正常文档评论,以便它们将出现在这些项目的工具提示中?
Doxygen 有不同的评论风格(参见手册中关于 "special comment blocks" 的部分,在本例中是关于 "Putting documentation after members" 的段落。
这里我们看到了可能性:
int var; /**< Detailed description after the member */
or
int var; //!< Detailed description after the member
//!<
or
int var; ///< Detailed description after the member
在这种情况下,我们可以从 ///<
切换到 //!<
为 Doxygen 处理编写的代码有这样的行是正常的。
int myVariable; ///< description of myVariable
但是,当 Visual Studio(例如 VS 2015)使用这些 Doxygen 注释准备的代码时,其 myVariable
的工具提示信息将显示
XML comment contains invalid XML: Whitespace is not allowed at this location.
问题似乎是紧跟在“///”之后的“<”。这似乎被 Visual Studio 解释为信号(格式不正确)XML 内容。但是,此组合与“<”一起出现,以向 Doxygen 发出信号,表明注释适用于行中的前一项,而不适用于后一项。
假设我们正在讨论已经遵循此 Doxygen 约定的现有代码体。很多地方已经这样写了
有没有办法调整或教导或设置 Visual Studio 以便它将此类评论视为前面项目的正常文档评论,以便它们将出现在这些项目的工具提示中?
Doxygen 有不同的评论风格(参见手册中关于 "special comment blocks" 的部分,在本例中是关于 "Putting documentation after members" 的段落。 这里我们看到了可能性:
int var; /**< Detailed description after the member */
or
int var; //!< Detailed description after the member
//!<
or
int var; ///< Detailed description after the member
在这种情况下,我们可以从 ///<
切换到 //!<