Eclipse Community Forums Forum Search:

Home » Language IDEs » C / C++ IDE (CDT) » Code Completion / Doxygen
Code Completion / Doxygen Wed, 12 May 2010 19:49
 Claude Messages: 2Registered: May 2010 Junior Member
Hi all,

I've got a little problem while using code completion in CDT.

I've created a C project, and creating a new C source file in it.

I created a new function in this file, say :

void sys_log_buffer(unsigned char log_severity, const char *log_string, ...)
{

}


If I wrote
/**
at the beginning of this line, and press Enter, Eclipse create a comment section like this :

/**
*
* @param log_severity
* @param log_string
*/


This is great but i want to customize a little this default message to make it Doxygen compliant. But my problem is I can't find anywhere in the Editor Preference how i can modify this comment.

I've search in Code Style / Code Templates (try to modify each of us, but with no result)

and also search in Editor / Templates (try to create a new template named /** , or modifying comment templates but with no result too)

Anyone can help me ?

Re: Code Completion / Doxygen [message #534938 is a reply to message #533269] Thu, 20 May 2010 17:52
 Claude Messages: 2Registered: May 2010 Junior Member
After more research, it seems to me that this thing is hardcoded in CDT. Anyone know which class/source file is concerned by this ?
Re: Code Completion / Doxygen [message #535875 is a reply to message #534938] Wed, 26 May 2010 07:38
 Harald Messages: 34Registered: July 2009 Member
AFAIK:

The extension point is
- org.eclipse.cdt.ui.DocCommentOwner

The contributed Doxygen Tool is in package
- org.eclipse.cdt.ui.text.doctools.doxygen

you can find in plugin
- org.eclipse.cdt.ui

Extending the doctools or contributing a advanced doxygen tool is a task on my todo list, too. The posibility to use a template for function comments etc. would be fine

--Harald
Re: Code Completion / Doxygen [message #646308 is a reply to message #535875] Thu, 23 December 2010 09:41
 Pieter SmithMessages: 1Registered: December 2010 Junior Member
I could not find a bug on this, so I made a new one: https://bugs.eclipse.org/bugs/show_bug.cgi?id=333134
Re: Code Completion / Doxygen [message #1737537 is a reply to message #535875] Sat, 09 July 2016 14:53
 zanget mikeMessages: 4Registered: July 2016 Junior Member
hi, Harald
i have used cdt for a long time but now i'm pretty sure i want to use the code temp for c/c++ method

would u please tell me how to achieve this?
im going to rebuild the jar you pointed out.
is it necessary??
Re: Code Completion / Doxygen [message #1752397 is a reply to message #1737537] Mon, 23 January 2017 12:02
 zanget mikeMessages: 4Registered: July 2016 Junior Member
after a little struggled with the code, i can make a little change.
now, this is what i found:

change result from func: documentFunctionParameters in file
org.eclipse.cdt\core\org.eclipse.cdt.ui\src\org\eclipse\cdt\ui\text\doctools\doxygen\DoxygenMultilineAutoEditStrategy.java

insert a new line here :
StringBuilder result= new StringBuilder();
--> result.append("@brief ").append(getLineDelimiter());
use mvn install to build the whole project and put the result :
org.eclipse.cdt.ui-6.2.0-SNAPSHOT.jar
to the plugin, then restart eclipse.

but i dont konw how to read the temp.
Re: Code Completion / Doxygen [message #1752474 is a reply to message #1752397] Tue, 24 January 2017 09:20
 zanget mikeMessages: 4Registered: July 2016 Junior Member
another patch is :
in the endof customizeDocumentAfterNewLine:

if(content.indexOf("@brief") >= 0) //$NON-NLS-1$
{
buf.deleteCharAt(buf.length()-1); //delete \n if we have added "@brief"
buf.deleteCharAt(buf.length()-1); //delete \n if we have added "@brief"
buf.deleteCharAt(buf.length()-1); //delete \n if we have added "@brief"
buf.deleteCharAt(buf.length()-1); //delete \n if we have added "@brief"
}
before:
buf.append(indent(content, indentation + MULTILINE_MID, lineDelim));

the comment from :
/**
*
* @brief
* @param str

Become :

/**
* @brief
* @param str

but one little scratch:

/**
* |@brief <------

the cursor is not at appropriate place.
 Previous Topic: Eclipse Juno CDT Indexer Not working (C++14) Next Topic: Trying to run Hello World
Goto Forum:

Current Time: Sat Jan 20 19:01:46 GMT 2018