From d5326a114a7146b46f8af3579d3865334156c5f7 Mon Sep 17 00:00:00 2001 From: Daniel Mathiot Date: Wed, 15 Jun 2022 10:33:07 +0200 Subject: [PATCH] fix: Return value instead of table in get_node_text Closes #99 --- lua/neogen/configurations/python.lua | 6 +++--- lua/neogen/utilities/extractors.lua | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/neogen/configurations/python.lua b/lua/neogen/configurations/python.lua index cb4b4f4..9469717 100644 --- a/lua/neogen/configurations/python.lua +++ b/lua/neogen/configurations/python.lua @@ -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 diff --git a/lua/neogen/utilities/extractors.lua b/lua/neogen/utilities/extractors.lua index 4c26767..3b209e1 100644 --- a/lua/neogen/utilities/extractors.lua +++ b/lua/neogen/utilities/extractors.lua @@ -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)