ref: Use typed parameters

This commit is contained in:
danymat
2023-01-12 22:30:28 +01:00
parent 6514bb1b50
commit ffefbd27ba

View File

@@ -127,7 +127,7 @@ return {
-- Check if the function is inside a class -- 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 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 local remove_identifier = true
-- Check if function is a static method. If so, will not remove the first parameter -- Check if function is a static method. If so, will not remove the first parameter
if node:parent():type() == "decorated_definition" then if node:parent():type() == "decorated_definition" then
@@ -138,9 +138,9 @@ return {
end end
end end
if remove_identifier then if remove_identifier then
table.remove(res.parameters, 1) table.remove(res[i.Parameter], 1)
if vim.tbl_isempty(res.parameters) then if vim.tbl_isempty(res[i.Parameter]) then
res.parameters = nil res[i.Parameter] = nil
end end
end end
end end