diff --git a/README.md b/README.md index bd29bb2..cc2da6c 100644 --- a/README.md +++ b/README.md @@ -233,7 +233,7 @@ There is a list of supported languages and fields, with their annotation style | cs | [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` | -| java | [Javadoc](https://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#documentationcomments) (`"javadoc`) | `func`, `class` | +| java | [Javadoc](https://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#documentationcomments) (`"javadoc`) | `func`, `class`, `type` | | javascript | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` | | javascriptreact | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` | | julia | [Julia](https://docs.julialang.org/en/v1/manual/documentation/#Writing-Documentation) (`"julia"`) | `func`, `class` | diff --git a/lua/neogen/configurations/java.lua b/lua/neogen/configurations/java.lua index c5a9c35..6e8660a 100644 --- a/lua/neogen/configurations/java.lua +++ b/lua/neogen/configurations/java.lua @@ -55,6 +55,7 @@ return { parent = { class = { "class_declaration", "interface_declaration", "record_declaration" }, func = { "method_declaration", "constructor_declaration" }, + type = { "field_declaration", "enum_constant", "formal_parameter" }, }, data = { @@ -139,6 +140,15 @@ return { }, }, }, + type = { + ["field_declaration|enum_constant|formal_parameter"] = { + ["0"] = { + extract = function() + return {} + end, + }, + }, + }, }, template = template:add_default_annotation("javadoc"), diff --git a/lua/neogen/templates/javadoc.lua b/lua/neogen/templates/javadoc.lua index c97ee54..d57bf03 100644 --- a/lua/neogen/templates/javadoc.lua +++ b/lua/neogen/templates/javadoc.lua @@ -1,9 +1,9 @@ local i = require("neogen.types.template").item return { - { nil, "/**", { no_results = true, type = { "class", "func" } } }, - { nil, " * $1", { no_results = true, type = { "class", "func" } } }, - { nil, " */", { no_results = true, type = { "class", "func" } } }, + { nil, "/**", { no_results = true, type = { "class", "func", "type" } } }, + { nil, " * $1", { no_results = true, type = { "class", "func", "type" } } }, + { nil, " */", { no_results = true, type = { "class", "func", "type" } } }, { nil, "/**" }, { nil, " * $1" },