Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: please support /// comments for c and c++ #146

Open
aerosayan opened this issue May 27, 2023 · 1 comment
Open

feature: please support /// comments for c and c++ #146

aerosayan opened this issue May 27, 2023 · 1 comment

Comments

@aerosayan
Copy link

Hello,

Thanks for creating neogen. I really love using it. It makes doxygen documenting code so easy. Literally saves hours.

Currently you support the default style of doxygen comments for c/c++ i.e /* doxygen comments here */

Could you please also support /// based comments?

For example, something like this:

    ///
    /// Subdivide the given node, and create 8 child nodes
    ///
    /// @param iLevelIdx : level index of parent node
    /// @param iSelfIdx : self index of parent node
    /// @param id : thread id
    ///
    void
    SubdivideNode(const oxint iLevelIdx, const oxint iSelfIdx, const oxint id);

    ///
    /// Set the required values of the newly created child nodes
    ///
    /// @param iParentLevelIdx : level index of parent node
    /// @param iParentIdx : self index of parent node
    /// @param iSelfIdx : self index of current child node
    /// @param iSiblingIdx : sibling index of current child node
    /// @param id : thread id
    ///
    void
    SetChildNode(
        const oxint iParentLevelIdx, const oxint iParentIdx,
        const oxint iSelfIdx, const oxint iSiblingIdx, const oxint id);

This style of comments is actually preferred by many c/c++ devs and it would be amazing if you could support it.

Thanks

@Luxni
Copy link

Luxni commented Jan 30, 2024

the example is described in "lua/neogen/template.lua",
i test in my lazyvim config, it's worked for me.

return {
  "danymat/neogen",
  dependencies = "nvim-treesitter/nvim-treesitter",
  config = true,
  opts = {
    languages = {
      c = {
        template = {
          annotation_convention = "my_doxygen",
          my_doxygen = {
            { nil, "/**", { no_results = true, type = { "func", "file", "class" } } },
            { nil, " * @file", { no_results = true, type = { "file" } } },
            { nil, " * @brief $1", { no_results = true, type = { "func", "file", "class" } } },
            { nil, " */", { no_results = true, type = { "func", "file", "class" } } },
            { nil, "", { no_results = true, type = { "file" } } },
            
            { nil, "///", { type = { "func", "class", "type" } } },
            { "class_name", " /// @class %s", { type = { "class" } } },
            { "type", "/// @typedef %s", { type = { "type" } } },
            { nil, "/// @brief $1", { type = { "func", "class", "type" } } },
            { nil, "///", { type = { "func", "class", "type" } } },
            { "tparam", "/// @tparam %s $1" },
            { "parameters", "/// @param %s $1" },
            { "return_statement", "/// @return $1" },
            { nil, "///", { type = { "func", "class", "type" } } },
},},},},},}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants