Xilconic
Xilconic

Reputation: 3845

Comment pop-up windows for C++ (Visual Studio), similar to Eclipse and Javadoc

In my years at college I've learned to program Java, which I did in Eclipse. I loved the feature in Eclipse on how Javadoc comments were able to pop-up in a window. At the moment I'm programming C++ and I'm really starting to miss this feature.

That's why I'm asking: is there a plug-in of something that acchieves the same result. Currently I am programming c++ with Visual Studio Express 2010, that does not have anything like this except for showing a function interface in the auto completion window. I would like to read more info such as reading up on pre- and postconditions for example, either for code from existing libraries (if they exist) or otherwise only for code I wrote myself.

Now I know of Doxygen, but that it not really what I'm looking for. It is a good enough fall back mechanism, but I really like to have it readily available from the same window I'm writing my code in.

Does something like this exist for Visual Studio? Or can I start using the C++ version of Eclipse and run the Javadoc generator there (I actually haven't tried this!) to get those nice pop-up comments?

EDIT: I've been trying to get XML style comments working, but something like:

/// <summary>This constructor takes parameters to set the 
/// members of the Cow class.
/// <param name="ho">Hobby as string of the cow.</param>
/// <param name="wt">Weight of the cow as a double.</param>
/// </summary>
Cow(const char * nm, double wt);

still only gives me the string "Cow(const char * nm, double wt)" in the pop-up window. Built with the \doc option, I do have a .xml file generated (in my Debug folder).

Upvotes: 8

Views: 2433

Answers (3)

Tim
Tim

Reputation: 84

Use SandCastle to integrate with the builtin help (F1). Its not as good as inline help like you get in Eclipse, but you can hover over a type, press F1 and then you are there.

To do this, install Sandcastle and Sandcastle Help File Builder. Then in your Sandcastle Help File Builder project, make sure to tick the box for MSHelpViewer. This will generate documentation and a script you can run to integrate your custom documentation into the F1 help.

Upvotes: 0

Tim
Tim

Reputation: 84

If you have CodeRush/Refactor you can try the CR_Documenter plugin (use VS Extension Manager). It provides a new dockable window with such documentation.

I am with you - Eclipse is so much better for viewing documentation.

Upvotes: 0

Carlito
Carlito

Reputation: 805

In C# you can write

///

And it will generate a XML style comment like:

/// <summary>
///
/// </summary>
/// <param name="parameter"> </param>
/// <returns> </returns>

You can let Visual Studio generate an XML file, which can be processed to get something like javadoc. I'm 100% sure it works on C#, but it seems that C++ uses a different style. If I go to project options > Configuration Options > XML Document Generator > General, and set the "Validate IntelliSense" to Yes, you can place comments in your .h file:

class Test {
    public:
        // The constructor
        Test(void);
        // The destructor
        ~Test(void);
        // The function description
        void Function();
};

If I go to my main.cpp, and type this:

Test * test = new Test();
test->

As soon as I hit the '>', a box pops up with a list of functions (destructor and the function in this case). If I select Function for example, a tooltip pops up with "The function description":

void Test::Function();

The function description
File: test.h

I'm not sure if there are any plugins, but I hope I helped you a bit here!

Upvotes: 2

Related Questions