feat(ts,js) Add support for file annotations (#31)
This commit is contained in:
12
README.md
12
README.md
@@ -182,14 +182,14 @@ There is a list of supported languages and fields, with their annotation style
|
|||||||
| python | | | `func`, `class`, `file` |
|
| python | | | `func`, `class`, `file` |
|
||||||
| | [Google docstrings](https://google.github.io/styleguide/pyguide.html) (`"google_docstrings"`) | `Args`, `Attributes`, `Returns` |
|
| | [Google docstrings](https://google.github.io/styleguide/pyguide.html) (`"google_docstrings"`) | `Args`, `Attributes`, `Returns` |
|
||||||
| | [Numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) (`"numpydoc"`)| `Arguments`, `Attributes`, `Returns`|
|
| | [Numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) (`"numpydoc"`)| `Arguments`, `Attributes`, `Returns`|
|
||||||
| javascript | | | `func`, `class` |
|
| javascript | | | `func`, `class`, `file`|
|
||||||
| | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `@param`, `@returns`, `@class`, `@classdesc` |
|
| | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `@param`, `@returns`, `@class`, `@classdesc`, `@module`|
|
||||||
| typescript | | | `func`, `class` |
|
| typescript | | | `func`, `class`, `file`|
|
||||||
| | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `@param`, `@returns`, `@class`, `@classdesc`, `@type` |
|
| | [JSDoc](https://jsdoc.app) (`"jsdoc"`) | `@param`, `@returns`, `@class`, `@classdesc`, `@type`, `@module`|
|
||||||
| c | | | `func`, `file`|
|
| c | | | `func`, `file`|
|
||||||
| | [Doxygen](https://www.doxygen.nl/manual/commands.html) (`"doxygen"`) | `@param`, `@return`, `@brief`|
|
| | [Doxygen](https://www.doxygen.nl/manual/commands.html) (`"doxygen"`) | `@param`, `@return`, `@brief`, `@file`|
|
||||||
| cpp | | | `func`, `file` |
|
| cpp | | | `func`, `file` |
|
||||||
| | [Doxygen](https://www.doxygen.nl/manual/commands.html) (`"doxygen"`) | `@param`, `@return`, `@tparam`, `@brief`|
|
| | [Doxygen](https://www.doxygen.nl/manual/commands.html) (`"doxygen"`) | `@param`, `@return`, `@tparam`, `@brief`, `@file`|
|
||||||
| go | | | |
|
| go | | | |
|
||||||
| | [Godoc](https://go.dev/blog/godoc) (`"godoc"`) | |
|
| | [Godoc](https://go.dev/blog/godoc) (`"godoc"`) | |
|
||||||
| java | | | `func`, `class` |
|
| java | | | `func`, `class` |
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ return {
|
|||||||
parent = {
|
parent = {
|
||||||
func = { "function_declaration", "expression_statement", "variable_declaration", "lexical_declaration" },
|
func = { "function_declaration", "expression_statement", "variable_declaration", "lexical_declaration" },
|
||||||
class = { "function_declaration", "expression_statement", "variable_declaration", "class_declaration" },
|
class = { "function_declaration", "expression_statement", "variable_declaration", "class_declaration" },
|
||||||
|
file = { "program" },
|
||||||
},
|
},
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
@@ -79,6 +80,15 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
file = {
|
||||||
|
["program"] = {
|
||||||
|
["0"] = {
|
||||||
|
extract = function()
|
||||||
|
return {}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
template = {
|
template = {
|
||||||
@@ -86,7 +96,12 @@ return {
|
|||||||
use_default_comment = false,
|
use_default_comment = false,
|
||||||
|
|
||||||
jsdoc = {
|
jsdoc = {
|
||||||
{ nil, "/* $1 */", { no_results = true } },
|
{ nil, "/* $1 */", { no_results = true, type = { "func", "class" } } },
|
||||||
|
|
||||||
|
{ nil, "/**", { no_results = true, type = { "file" } } },
|
||||||
|
{ nil, " * @module $1", { no_results = true, type = { "file" } } },
|
||||||
|
{ nil, " */", { no_results = true, type = { "file" } } },
|
||||||
|
|
||||||
{ nil, "/**" },
|
{ nil, "/**" },
|
||||||
{ "class_tag", " * @classdesc $1", { before_first_item = { " * ", " * @class" }, type = { "class" } } },
|
{ "class_tag", " * @classdesc $1", { before_first_item = { " * ", " * @class" }, type = { "class" } } },
|
||||||
{ "parameters", " * @param {any} %s $1" },
|
{ "parameters", " * @param {any} %s $1" },
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ return {
|
|||||||
func = { "function_declaration", "expression_statement", "variable_declaration", "lexical_declaration" },
|
func = { "function_declaration", "expression_statement", "variable_declaration", "lexical_declaration" },
|
||||||
class = { "function_declaration", "expression_statement", "variable_declaration", "class_declaration" },
|
class = { "function_declaration", "expression_statement", "variable_declaration", "class_declaration" },
|
||||||
type = { "variable_declaration" },
|
type = { "variable_declaration" },
|
||||||
|
file = { "program" },
|
||||||
},
|
},
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
@@ -114,14 +115,27 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
file = {
|
||||||
|
["program"] = {
|
||||||
|
["0"] = {
|
||||||
|
extract = function()
|
||||||
|
return {}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
template = {
|
template = {
|
||||||
annotation_convention = "jsdoc",
|
annotation_convention = "jsdoc",
|
||||||
use_default_comment = false,
|
use_default_comment = false,
|
||||||
|
|
||||||
jsdoc = {
|
jsdoc = {
|
||||||
{ nil, "/* $1 */", { no_results = true } },
|
{ nil, "/* $1 */", { no_results = true, type = { "class", "func" } } },
|
||||||
|
|
||||||
|
{ nil, "/**", { no_results = true, type = { "file" } } },
|
||||||
|
{ nil, " * @module $1", { no_results = true, type = { "file" } } },
|
||||||
|
{ nil, " */", { no_results = true, type = { "file" } } },
|
||||||
|
|
||||||
{ nil, "/**" },
|
{ nil, "/**" },
|
||||||
{ "class_tag", " * @classdesc $1", { before_first_item = { " * ", " * @class" }, type = { "class" } } },
|
{ "class_tag", " * @classdesc $1", { before_first_item = { " * ", " * @class" }, type = { "class" } } },
|
||||||
{ "parameters", " * @param {any} %s $1" },
|
{ "parameters", " * @param {any} %s $1" },
|
||||||
|
|||||||
Reference in New Issue
Block a user