From 56620c019194273111c87030120baaa42b1c323a Mon Sep 17 00:00:00 2001 From: Chris Brendel Date: Thu, 12 Jan 2023 15:27:55 -0500 Subject: [PATCH] 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