Skip to content

Commit

Permalink
geanygendoc: Add support for local variables
Browse files Browse the repository at this point in the history
Since Geany 2.0 a lot of those are reported for several languages,
including C.  Those should usually not be documented, but their parent
should be instead, otherwise they "get in the way" of triggering
documentation of their parent.

Add support for the "local" match rule for local variables, and update
the default rules to use the FORWARD policy for them.  It's not
actually the parent documenting the child, but the effect is the same
as the user probably wanted to document the parent rather than the
local.
  • Loading branch information
b4n committed Nov 21, 2023
1 parent 8cad88d commit 3af0bf5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions geanygendoc/data/filetypes/c.conf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ doctypes = {
struct.prototype.policy = FORWARD;
member.policy = FORWARD;
enumval.policy = FORWARD;
# usually, locals are just not documented and get in the way
local.policy = FORWARD;

function = {
template = "/**\n * {symbol}:\n{for arg in argument_list} * @{arg}: {cursor}\n{end} * \n * {cursor}\n{if returns} * \n * Returns: \n{end}{if write_since}{if returns} * \n{end} * Since: \n{end} */\n";
Expand Down Expand Up @@ -73,6 +75,9 @@ doctypes = {
}

doxygen = {
# usually, locals are just not documented and get in the way
local.policy = FORWARD;

function.template = "/**\n * {doxygen_prefix}brief {cursor}\n{for a in argument_list} * {doxygen_prefix}param {a} \n{end}{if returns} * {doxygen_prefix}returns \n{end}{if write_since} * {doxygen_prefix}since \n{end} * \n * \n */\n";
macro.template = "/**\n * {doxygen_prefix}brief {cursor}\n{for a in argument_list} * {doxygen_prefix}param {a} \n{end}{if returns} * {doxygen_prefix}returns \n{end}{if write_since} * {doxygen_prefix}since \n{end} * \n * \n */\n";
struct.member = {
Expand Down
2 changes: 2 additions & 0 deletions geanygendoc/docs/manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ Known types
A function.
``interface``
An interface.
``local``
A local variable.
``member``
A member (of a structure for example).
``method``
Expand Down
1 change: 1 addition & 0 deletions geanygendoc/src/ggd-tag-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ static const struct {
{ tm_tag_field_t, "field" },
{ tm_tag_function_t, "function" },
{ tm_tag_interface_t, "interface" },
{ tm_tag_local_var_t, "local" },
{ tm_tag_member_t, "member" },
{ tm_tag_method_t, "method" },
{ tm_tag_namespace_t, "namespace" },
Expand Down

0 comments on commit 3af0bf5

Please sign in to comment.