diff --git a/README.md b/README.md index e0c0b77..9b6dce0 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,7 @@ There is a list of supported languages and fields, with their annotation style | Languages | Annotation Conventions | Supported annotation types | | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- | | sh | [Google Style Guide](https://google.github.io/styleguide/shellguide.html) (`"google_bash"`) | `func`, `file` | -| c | [Doxygen](https://www.doxygen.nl/manual/commands.html) (`"doxygen"`) | `func`, `file` | +| c | [Doxygen](https://www.doxygen.nl/manual/commands.html) (`"doxygen"`) | `func`, `file`, `type` | | csharp | [Xmldoc](https://docs.microsoft.com/fr-fr/dotnet/csharp/language-reference/xmldoc/) (`"xmldoc"`)
[Doxygen](https://www.doxygen.nl/manual/commands.html) (`"doxygen"`) | `func`, `file`, `class` | | cpp | [Doxygen](https://www.doxygen.nl/manual/commands.html) (`"doxygen"`) | `func`, `file`, `class` | | go | [GoDoc](https://go.dev/blog/godoc) (`"godoc"`) | `func`, `type` | diff --git a/lua/neogen/configurations/c.lua b/lua/neogen/configurations/c.lua index 27fd014..9260aa5 100644 --- a/lua/neogen/configurations/c.lua +++ b/lua/neogen/configurations/c.lua @@ -122,6 +122,7 @@ local c_config = { "template_declaration", }, file = { "translation_unit" }, + type = { "type_definition" }, }, data = { @@ -141,6 +142,20 @@ local c_config = { }, }, }, + type = { + ["type_definition"] = { + ["1"] = { + extract = function(node) + local tree = { + { retrieve = "first", node_type = "type_identifier", extract = true, as = i.Type }, + } + local nodes = nodes_utils:matching_nodes_from(node, tree) + local res = extractors:extract_from_matched(nodes) + return res + end, + }, + }, + }, }, locator = function(node_info, nodes_to_match) diff --git a/lua/neogen/templates/doxygen.lua b/lua/neogen/templates/doxygen.lua index 020ecca..5fe9a78 100644 --- a/lua/neogen/templates/doxygen.lua +++ b/lua/neogen/templates/doxygen.lua @@ -6,12 +6,13 @@ return { { nil, " */", { no_results = true, type = { "func", "file", "class" } } }, { nil, "", { no_results = true, type = { "file" } } }, - { nil, "/**", { type = { "func", "class" } } }, + { nil, "/**", { type = { "func", "class", "type" } } }, { i.ClassName, " * @class %s", { type = { "class" } } }, - { nil, " * @brief $1", { type = { "func", "class" } } }, - { nil, " *", { type = { "func", "class" } } }, + { i.Type, " * @typedef $1", { type = { "type" } } }, + { nil, " * @brief $1", { type = { "func", "class", "type" } } }, + { nil, " *", { type = { "func", "class", "type" } } }, { i.Tparam, " * @tparam %s $1" }, { i.Parameter, " * @param %s $1" }, { i.Return, " * @return $1" }, - { nil, " */", { type = { "func", "class" } } }, + { nil, " */", { type = { "func", "class", "type" } } }, }