fix: Return value instead of table in get_node_text

Closes #99
This commit is contained in:
Daniel Mathiot
2022-06-15 10:33:07 +02:00
parent 08c88e2a85
commit d5326a114a
2 changed files with 4 additions and 4 deletions

View File

@@ -110,7 +110,7 @@ return {
-- Check if function is a static method. If so, will not remove the first parameter
if node:parent():type() == "decorated_definition" then
local decorator = nodes_utils:matching_child_nodes(node:parent(), "decorator")
decorator = helpers.get_node_text(decorator[1])
decorator = helpers.get_node_text(decorator[1])[1]
if decorator == "@staticmethod" then
remove_identifier = false
end
@@ -185,7 +185,7 @@ return {
for _, assignment in pairs(nodes["assignment"]) do
local left_side = assignment:field("left")[1]
local left_attribute = left_side:field("attribute")[1]
left_attribute = helpers.get_node_text(left_attribute)
left_attribute = helpers.get_node_text(left_attribute)[1]
if left_attribute and not vim.startswith(left_attribute, "_") then
table.insert(results[i.ClassAttribute], left_attribute)
end
@@ -233,7 +233,7 @@ return {
if child:type() == "comment" then
local start_row = child:start()
if start_row == 0 then
if vim.startswith(helpers.get_node_text(node), "#!") then
if vim.startswith(helpers.get_node_text(node)[1], "#!") then
return 1, 0
end
end

View File

@@ -14,7 +14,7 @@ return {
return node:type()
end
local get_text = function(node)
return helpers.get_node_text(node)
return helpers.get_node_text(node)[1]
end
if opts.type then
result[k] = vim.tbl_map(get_type, v)