Merge pull request #124 from cdbrendel/fix-python-args
Fix parameters in python docstrings
This commit is contained in:
@@ -50,7 +50,7 @@ return {
|
||||
retrieve = "all",
|
||||
node_type = "typed_default_parameter",
|
||||
as = i.Tparam,
|
||||
extract = true
|
||||
extract = true,
|
||||
},
|
||||
{
|
||||
retrieve = "first",
|
||||
@@ -85,6 +85,7 @@ return {
|
||||
{
|
||||
retrieve = "first",
|
||||
node_type = "identifier",
|
||||
recursive = true,
|
||||
extract = true,
|
||||
as = i.Throw,
|
||||
},
|
||||
@@ -126,7 +127,7 @@ return {
|
||||
|
||||
-- Check if the function is inside a class
|
||||
-- If so, remove reference to the first parameter (that can be `self`, `cls`, or a custom name)
|
||||
if res.identifier and locator({ current = node }, parent.class) then
|
||||
if res[i.Parameter] and locator({ current = node }, parent.class) then
|
||||
local remove_identifier = true
|
||||
-- Check if function is a static method. If so, will not remove the first parameter
|
||||
if node:parent():type() == "decorated_definition" then
|
||||
@@ -137,9 +138,9 @@ return {
|
||||
end
|
||||
end
|
||||
if remove_identifier then
|
||||
table.remove(res.identifier, 1)
|
||||
if vim.tbl_isempty(res.identifier) then
|
||||
res.identifier = nil
|
||||
table.remove(res[i.Parameter], 1)
|
||||
if vim.tbl_isempty(res[i.Parameter]) then
|
||||
res[i.Parameter] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -241,6 +241,9 @@ end
|
||||
---
|
||||
--- Note: We will only document `major` and `minor` versions, not `patch` ones. (only X and Y in X.Y.z)
|
||||
---
|
||||
--- ## 2.13.0~
|
||||
--- - Improve google docstrings template (#124)
|
||||
--- - Fix minor python retriever issues (#124)
|
||||
--- ## 2.12.0~
|
||||
--- - Fetch singleton methods in ruby (#121)
|
||||
--- ## 2.11.0~
|
||||
@@ -292,7 +295,7 @@ end
|
||||
--- with multiple annotation conventions.
|
||||
---@tag neogen-changelog
|
||||
---@toc_entry Changes in neogen plugin
|
||||
neogen.version = "2.12.0"
|
||||
neogen.version = "2.13.0"
|
||||
--minidoc_afterlines_end
|
||||
|
||||
return neogen
|
||||
|
||||
@@ -14,7 +14,7 @@ return {
|
||||
{ i.HasParameter, "", { type = { "func" } } },
|
||||
{ i.HasParameter, "Args:", { type = { "func" } } },
|
||||
{ i.Parameter, " %s ($1): $1", { type = { "func" } } },
|
||||
{ { i.Parameter, i.Type }, " %s (%s): $1", { required = i.Tparam, type = { "func" } } },
|
||||
{ { i.Parameter, i.Type }, " %s: $1", { required = i.Tparam, type = { "func" } } },
|
||||
{ i.ArbitraryArgs, " %s: $1", { type = { "func" } } },
|
||||
{ i.Kwargs, " %s: $1", { type = { "func" } } },
|
||||
{ i.ClassAttribute, " %s: $1", { before_first_item = { "", "Attributes: " } } },
|
||||
|
||||
Reference in New Issue
Block a user