Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change doxygen comment style in Eclipse

Does anyone know how to edit the style used for Doxygen comments in Eclipse CDT?

In other words type /** and pressing enter on a line before a function currently gives me something like:

/**
 * 
 * @param one
 * @param two
 * @return
 */
Foo(int one, int two);

and I want it to give me something like:

/**********************************************************************/
///
/// \param one
/// \param two
/// \return
/***********************************************************************/
Foo(int one, int two);

Also, plus one if anyone knows how to bind this to a keyboard shortcut (like alt-shift-j for Eclipse JDT).

Also, FYI, the fact that Eclipse CDT supports Doxygen now seems to be a little known fact based on Google. See here for details. Doxygen can be enabled under the project properties by selecting "Enable project specific settings" in the "C/C++ General" tab and selecting "Doxygen". My CDT version is 7.0.1, but I think this became available in 5.0.

Lastly, the comments section under code templates in preferences doesn't accomplish this based on my testing.

EDIT: See here. It seems like the comment style is hard coded. If anyone finds otherwise, I'd love to know about it. I guess templates will be the best thing for now unless the Javadoc style is okay for you.

like image 226
deuberger Avatar asked Dec 09 '10 21:12

deuberger


2 Answers

Yes, this seems to be a bug in Eclipse CDT.

As a workaround I suggest you create a custom template which can be accessed with the Ctrl+Space key combination.

In Eclipse Helios: Window -> Preferences -> C/C++ -> Editor -> Templates

Click on New... to create a new template and in the Name field use some descriptive name e.g. "comment-function", and add your doxygen comment in the Pattern field. Confirm and apply this change.

In your code you can then go to the line above your function declaration, type the first few letters of your custom template name followed by the Ctrl+Space key combination.

In this example:

com<Ctrl+space>

will bring up the Content Assist dialog filtered with "com*" from which you can select the "comment-function" template.

Note:

com<Ctrl+space+space>

will filter even further by only showing Template Proposals in the Content Assist pop-up window.

like image 52
Theuns Alberts Avatar answered Oct 21 '22 12:10

Theuns Alberts


This is a configuration I found in my java comment

Javadoc comment modification

and when i edited as shown my java doc comment changed to

image in java editor

Try to look for similar configuration under your php configuration.

like image 1
Naveen Babu Avatar answered Oct 21 '22 11:10

Naveen Babu