如何让完整的智能感知工具提示评论正常工作?

发布于 2024-08-24 17:05:02 字数 1883 浏览 3 评论 0原文

我有一些 C++/CLI 软件,这些软件都很好,并且以 C# 式的方式进行记录,这意味着 DOxygen 能够将其提取到一些漂亮的 html 中。有什么方法可以像 .net 框架那样让相同的信息出现在智能感知工具提示中吗?

例如,假设这是我的头文件 (MyApp.h):

    /*************** MyApp.h ***************/

    /// My namespace containing all my funky classes
    namespace MyNamespace
    {
            using namespace System;

            ref class WorldHunger;

            /// A truly elegent class which solves all the worlds problems
            public ref class MyClass
            {
            public:
                    /// Constructs a MyClass
                    MyClass()
                    {

                    }


                    /// <summary>Attempts to fix world hunger</summary>
                    /// <param name="problem">The problem to try and fix</param>
                    /// <returns>Whether or not the problem was solved</param>
                    bool FixWorldHunger( WorldHunger^ problem );
            };
    }

...这是相应的实现:

    /*************** MyApp.cpp ***************/

    #include "MyApp.h"

    using namespace MyNamespace;

    MyClass::MyClass()
    {

    }

    bool MyClass::FixWorldHunger( WorldHunger^ problem )
    {
            bool result = false;

            /// TODO: implement something clever

            return result;
    }

这是当我键入时智能感知对内置函数所做的操作: http://www.geekops .co.uk/photos/0000-00-02%20%28Forum%20images%29/BrokenIntellisense1.jpg

这是当我键入时智能感知对我自己的函数所做的操作: http://www.geekops .co.uk/photos/0000-00-02%20%28Forum%20images%29/BrokenIntellisense2.jpg

当然有办法做到这一点吗?

I've got some C++/CLI software which is all nice and documented in a C#'ish kind of way which means DOxygen is able to pull it out into some nice html. Is there any way I can get that same information to appear in the intellisense tool tips the way that the .net framework does?

For example, lets say this is my header file (MyApp.h):

    /*************** MyApp.h ***************/

    /// My namespace containing all my funky classes
    namespace MyNamespace
    {
            using namespace System;

            ref class WorldHunger;

            /// A truly elegent class which solves all the worlds problems
            public ref class MyClass
            {
            public:
                    /// Constructs a MyClass
                    MyClass()
                    {

                    }


                    /// <summary>Attempts to fix world hunger</summary>
                    /// <param name="problem">The problem to try and fix</param>
                    /// <returns>Whether or not the problem was solved</param>
                    bool FixWorldHunger( WorldHunger^ problem );
            };
    }

...and this it's corresponding implementation:

    /*************** MyApp.cpp ***************/

    #include "MyApp.h"

    using namespace MyNamespace;

    MyClass::MyClass()
    {

    }

    bool MyClass::FixWorldHunger( WorldHunger^ problem )
    {
            bool result = false;

            /// TODO: implement something clever

            return result;
    }

Here's what intellisense does for built in functions when I'm typing:
http://www.geekops.co.uk/photos/0000-00-02%20%28Forum%20images%29/BrokenIntellisense1.jpg

Here's what intellisense does for my own functions when I type:
http://www.geekops.co.uk/photos/0000-00-02%20%28Forum%20images%29/BrokenIntellisense2.jpg

Surely there's a way to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

奶茶白久 2024-08-31 17:05:02

总而言之,要使其工作,您需要以兼容的形式提供注释:

/// <summary>
/// Retrieves the widget at the specified index
/// </summary>
/// <param name="widgetIndex">Index of the widget to retrieve.</param>
/// <returns>The widget at the specified index</returns>
Widget* GetWidget(int widgetIndex);

然后您只需在 Visual Studio 中右键单击该项目,然后转到“properties”>“properties”即可。配置属性> C/C++>输出文件并将生成 XML 文档文件更改为

当您重建项目并将其导入其他位置时,您应该会看到出现完整记录的工具提示。

Just to summarise, for this to work you need your comments in a compatible form:

/// <summary>
/// Retrieves the widget at the specified index
/// </summary>
/// <param name="widgetIndex">Index of the widget to retrieve.</param>
/// <returns>The widget at the specified index</returns>
Widget* GetWidget(int widgetIndex);

Then you simply right-click on the project in Visual Studio and go to properties > configuration properties > C/C++ > Output Files and change Generate XML Documentation Files to Yes.

When you rebuild your project ad import it somewhere else, you should see fully documented tooltips appear.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文