Change doxygen comment style in Eclipse

后端 未结 5 932
南笙
南笙 2021-02-01 03:28

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 curren

相关标签:
5条回答
  • 2021-02-01 03:43

    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.

    0 讨论(0)
  • 2021-02-01 03:47

    A Doxygen tag uses this basic format.

    /**
    Your tags and such. It MUST have the /** and the */.
    */
    

    It absolutely must have the /** */ around the whole Doxygen comment. If you modify the Code Templates it will do what you want.

    The proposed comment style is wrong though.

    /***************/ <-- These are terminated Doxygen blocks.
    /// <-- These are used in xml style Doxygen blocks.
    ///
    /// This isn't actually a Doxygen block and shouldn't work
    /// if you run Doxygen on it.
    ///
    /***************/ <-- These are terminated Doxygen blocks.
    

    This below is standard for most companies who code in JAVA and eclipse. Since Doxygen is valid for multiple languages this is valid for C/C++ too.

    /**
     * Brief description.
     *
     * @param[in|out] <value> <description>
     */
    

    If you want to use the xml style tags...

    /// <summary>
    /// This is a summary of the class, blah, blah.
    /// </summary>
    

    You're also going to want to make sure eclipse isn't inserting other comment styles too, otherwise you can end up with comments inserted inside other comments. Also generally it is a bad rule to mix comment styles like /** */ and ///.

    Finally if you select auto-generate comments when you create classes and such those comments will automatically be put in. And you can have eclipse auto-generate method headers as you type (though I forget how I did this).

    0 讨论(0)
  • 2021-02-01 03:49

    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.

    0 讨论(0)
  • 2021-02-01 03:59

    Starting from eclipse 2020-03 you can use a combination of options: code template to create your header and footer using /*****/ and then in the middle just use /// customizing the style in C/C++->Editor options.

    0 讨论(0)
  • 2021-02-01 04:01

    I can get some of the way to what you want by going to: Preferences - PHP - Code Style - Code Templates - Comments.

    I'm not sure that this will enable you to use backslashes instead of @s for your keywords, but I think it should achieve most of what you want.

    0 讨论(0)
提交回复
热议问题