How to get full intellisense tooltip comments work

2019-02-07 07:14发布

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?

1条回答
叼着烟拽天下
2楼-- · 2019-02-07 07:33

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.

查看更多
登录 后发表回答