fix(py) Always get public parameters for classes

This commit is contained in:
danymat
2022-01-29 13:06:53 +01:00
parent fb707c0fd3
commit fe44b20a57

View File

@@ -108,12 +108,14 @@ return {
},
class = {
["class_definition"] = {
["2"] = {
match = "block",
["0"] = {
extract = function(node)
local results = {}
local tree = {
{
retrieve = "first",
node_type = "block",
subtree = {
{
retrieve = "first",
node_type = "function_definition",
@@ -126,7 +128,13 @@ return {
retrieve = "all",
node_type = "expression_statement",
subtree = {
{ retrieve = "first", node_type = "assignment", extract = true },
{
retrieve = "first",
node_type = "assignment",
extract = true,
},
},
},
},
},
},
@@ -145,7 +153,10 @@ return {
for _, assignment in pairs(nodes["assignment"]) do
local left_side = assignment:field("left")[1]
local left_attribute = left_side:field("attribute")[1]
table.insert(results.attributes, ts_utils.get_node_text(left_attribute)[1])
left_attribute = ts_utils.get_node_text(left_attribute)[1]
if not vim.startswith(left_attribute, "_") then
table.insert(results.attributes, left_attribute)
end
end
return results