diff --git a/README.md b/README.md index 1591a3f..9ba819c 100644 --- a/README.md +++ b/README.md @@ -187,22 +187,22 @@ require('neogen').setup { There is a list of supported languages and fields, with their annotation style -| Languages | Annotation Conventions | Supported annotation types | -| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- | -| c | [Doxygen](https://www.doxygen.nl/manual/commands.html) (`"doxygen"`) | `func`, `file` | -| 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` | -| java | [Javadoc](https://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#documentationcomments) (`"javadoc`) | `func`, `class` | -| javascript | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` | -| jsx | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` | -| lua | [Emmylua](https://emmylua.github.io/) (`"emmylua"`)
[Ldoc](https://stevedonovan.github.io/ldoc/manual/doc.md.html) (`"ldoc"`) | `func`, `class`, `type`, `file` | -| php | [Php-doc](https://docs.phpdoc.org/3.0/guide/references/phpdoc/index.html) (`"phpdoc"`) | `func`, `type`, `class` | -| python | [Google docstrings](https://google.github.io/styleguide/pyguide.html) (`"google_docstrings"`)
[Numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) (`"numpydoc"`) | `func`, `class`, `type`, `file` | -| rust | [RustDoc](https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) (`"rustdoc"`)
[Alternative](https://stackoverflow.com/questions/30009650/how-do-you-document-function-arguments) (`"alternative"`) | `func`, `file`, `class` | -| typescript | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` | -| tsx | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` | -| vue | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` | +| Languages | Annotation Conventions | Supported annotation types | +| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- | +| c | [Doxygen](https://www.doxygen.nl/manual/commands.html) (`"doxygen"`) | `func`, `file` | +| 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` | +| java | [Javadoc](https://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#documentationcomments) (`"javadoc`) | `func`, `class` | +| javascript | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` | +| jsx | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` | +| lua | [Emmylua](https://emmylua.github.io/) (`"emmylua"`)
[Ldoc](https://stevedonovan.github.io/ldoc/manual/doc.md.html) (`"ldoc"`) | `func`, `class`, `type`, `file` | +| php | [Php-doc](https://docs.phpdoc.org/3.0/guide/references/phpdoc/index.html) (`"phpdoc"`) | `func`, `type`, `class` | +| python | [Google docstrings](https://google.github.io/styleguide/pyguide.html) (`"google_docstrings"`)
[Numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) (`"numpydoc"`)
[reST](https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html) (`"reST"`) | `func`, `class`, `type`, `file` | +| rust | [RustDoc](https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) (`"rustdoc"`)
[Alternative](https://stackoverflow.com/questions/30009650/how-do-you-document-function-arguments) (`"alternative"`) | `func`, `file`, `class` | +| typescript | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` | +| tsx | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` | +| vue | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `func`, `class`, `type`, `file` | ## Adding Languages diff --git a/lua/neogen/configurations/python.lua b/lua/neogen/configurations/python.lua index 5490b1f..d70e0f9 100644 --- a/lua/neogen/configurations/python.lua +++ b/lua/neogen/configurations/python.lua @@ -57,12 +57,14 @@ return { retrieve = "all", node_type = "true|false|integer|binary_operator|expression_list", as = "anonymous_return", + recursive = true, extract = true, }, { retrieve = "all", node_type = "identifier", as = "return_statement", + recursive = true, extract = true, }, }, @@ -73,6 +75,7 @@ return { retrieve = "all", node_type = "type", as = "return_type", + recursive = true, extract = true, }, } @@ -270,5 +273,36 @@ return { }, { nil, '"""' }, }, + reST = { + { nil, '""" $1 """', { no_results = true, type = { "class", "func" } } }, + { nil, '"""$1', { no_results = true, type = { "file" } } }, + { nil, "", { no_results = true, type = { "file" } } }, + { nil, "$1", { no_results = true, type = { "file" } } }, + { nil, '"""', { no_results = true, type = { "file" } } }, + { nil, "", { no_results = true, type = { "file" } } }, + + { nil, "# $1", { no_results = true, type = { "type" } } }, + + { nil, '"""$1' }, + { nil, "" }, + { + "parameters", + ":param %s: $1", + { after_each = ":type %s: $1", type = { "func" } }, + }, + { + { "identifier", "type" }, + ":param %s: $1", + { + after_each = { ":type %s: $1", index_types = { 2 } }, + required = "typed_parameters", + type = { "func" }, + }, + }, + { "attributes", ":param %s: $1" }, + { "has_return", ":return: $1", { type = { "func" } } }, + { "has_return", ":rtype: $1", { type = { "func" } } }, + { nil, '"""' }, + }, }, }