diff --git a/lua/neogen/configurations/python.lua b/lua/neogen/configurations/python.lua index 63ebdd2..23deafc 100644 --- a/lua/neogen/configurations/python.lua +++ b/lua/neogen/configurations/python.lua @@ -30,7 +30,6 @@ return { node_type = "parameters", subtree = { { retrieve = "all", node_type = "identifier", extract = true }, - { retrieve = "all", node_type = "default_parameter", @@ -48,6 +47,18 @@ return { extract = true, subtree = { { retrieve = "all", node_type = "identifier", extract = true } }, }, + { + retrieve = "first", + node_type = "list_splat_pattern", + extract = true, + as = i.ArbitraryArgs, + }, + { + retrieve = "first", + node_type = "dictionary_splat_pattern", + extract = true, + as = i.ArbitraryArgs, + }, }, }, { @@ -120,6 +131,8 @@ return { results[i.HasReturn] = (res.return_statement or res.anonymous_return or res[i.ReturnTypeHint]) and { true } or nil + results[i.ArbitraryArgs] = res[i.ArbitraryArgs] + results[i.Kwargs] = res[i.Kwargs] return results end, }, diff --git a/lua/neogen/templates/google_docstrings.lua b/lua/neogen/templates/google_docstrings.lua index 9662773..427bdda 100644 --- a/lua/neogen/templates/google_docstrings.lua +++ b/lua/neogen/templates/google_docstrings.lua @@ -15,6 +15,8 @@ return { { i.HasParameter, "Args:", { type = { "func" } } }, { i.Parameter, " %s ($1): $1", { type = { "func" } } }, { { i.Parameter, i.Type }, " %s (%s): $1", { required = "typed_parameters", type = { "func" } } }, + { i.ArbitraryArgs, " %s: $1", { type = { "func" } } }, + { i.Kwargs, " %s: $1", { type = { "func" } } }, { i.ClassAttribute, " %s: $1", { before_first_item = { "", "Attributes: " } } }, { i.HasReturn, "", { type = { "func" } } }, { i.HasReturn, "Returns:", { type = { "func" } } }, diff --git a/lua/neogen/templates/numpydoc.lua b/lua/neogen/templates/numpydoc.lua index c650a12..9993472 100644 --- a/lua/neogen/templates/numpydoc.lua +++ b/lua/neogen/templates/numpydoc.lua @@ -24,6 +24,16 @@ return { "%s : %s", { after_each = " $1", required = "typed_parameters", type = { "func" } }, }, + { + i.ArbitraryArgs, + "%s", + { after_each = " $1", type = { "func" } }, + }, + { + i.Kwargs, + "%s", + { after_each = " $1", type = { "func" } }, + }, { i.ClassAttribute, "%s : $1", { before_first_item = { "", "Attributes", "----------" } } }, { i.HasReturn, "", { type = { "func" } } }, { i.HasReturn, "Returns", { type = { "func" } } }, diff --git a/lua/neogen/types/template.lua b/lua/neogen/types/template.lua index f82b4bb..ade0c72 100644 --- a/lua/neogen/types/template.lua +++ b/lua/neogen/types/template.lua @@ -18,6 +18,8 @@ template.item = { ClassAttribute = "attributes", HasParameter = "has_parameters", HasReturn = "has_return", + ArbitraryArgs = "arbitrary_args", + Kwargs = "kwargs", } return template diff --git a/scripts/get_version.lua b/scripts/get_version.lua index c3f4896..3c7c733 100644 --- a/scripts/get_version.lua +++ b/scripts/get_version.lua @@ -1 +1 @@ -print(require('neogen').version) +print(require("neogen").version)