From 41fe4ba304d74c6fe15f57a45c3b4d8926a27908 Mon Sep 17 00:00:00 2001 From: Chris Brendel Date: Thu, 12 Jan 2023 15:21:47 -0500 Subject: [PATCH 1/5] allow instantiated exceptions to be extracted --- lua/neogen/configurations/python.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/neogen/configurations/python.lua b/lua/neogen/configurations/python.lua index c42caaf..a424d1e 100644 --- a/lua/neogen/configurations/python.lua +++ b/lua/neogen/configurations/python.lua @@ -85,6 +85,7 @@ return { { retrieve = "first", node_type = "identifier", + recursive = true, extract = true, as = i.Throw, }, From 56620c019194273111c87030120baaa42b1c323a Mon Sep 17 00:00:00 2001 From: Chris Brendel Date: Thu, 12 Jan 2023 15:27:55 -0500 Subject: [PATCH 2/5] restored behavior removing `self`/`cls` argument for func in class --- lua/neogen/configurations/python.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/neogen/configurations/python.lua b/lua/neogen/configurations/python.lua index a424d1e..2fc141e 100644 --- a/lua/neogen/configurations/python.lua +++ b/lua/neogen/configurations/python.lua @@ -50,7 +50,7 @@ return { retrieve = "all", node_type = "typed_default_parameter", as = i.Tparam, - extract = true + extract = true, }, { retrieve = "first", @@ -127,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.parameters 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 @@ -138,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.parameters, 1) + if vim.tbl_isempty(res.parameters) then + res.parameters = nil end end end From 6514bb1b501083d8687e723c0a0e7b115281c872 Mon Sep 17 00:00:00 2001 From: Chris Brendel Date: Thu, 12 Jan 2023 15:29:09 -0500 Subject: [PATCH 3/5] removed type from docstring when type hint is given --- lua/neogen/templates/google_docstrings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/neogen/templates/google_docstrings.lua b/lua/neogen/templates/google_docstrings.lua index a901e9f..cdc78f5 100644 --- a/lua/neogen/templates/google_docstrings.lua +++ b/lua/neogen/templates/google_docstrings.lua @@ -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: " } } }, From ffefbd27ba983d408c2e184ed56f878265d74a88 Mon Sep 17 00:00:00 2001 From: danymat Date: Thu, 12 Jan 2023 22:30:28 +0100 Subject: [PATCH 4/5] ref: Use typed parameters --- lua/neogen/configurations/python.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/neogen/configurations/python.lua b/lua/neogen/configurations/python.lua index 2fc141e..e1b49d2 100644 --- a/lua/neogen/configurations/python.lua +++ b/lua/neogen/configurations/python.lua @@ -127,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.parameters 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 @@ -138,9 +138,9 @@ return { end end if remove_identifier then - table.remove(res.parameters, 1) - if vim.tbl_isempty(res.parameters) then - res.parameters = nil + table.remove(res[i.Parameter], 1) + if vim.tbl_isempty(res[i.Parameter]) then + res[i.Parameter] = nil end end end From 5a9ac284d458b6a08f97f2759e3c952bcf07a148 Mon Sep 17 00:00:00 2001 From: danymat Date: Thu, 12 Jan 2023 22:37:18 +0100 Subject: [PATCH 5/5] ref: Versioning --- lua/neogen/init.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/neogen/init.lua b/lua/neogen/init.lua index 7aa2973..b47380f 100644 --- a/lua/neogen/init.lua +++ b/lua/neogen/init.lua @@ -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