From 4fc9322019bb3c338f30910cacea8bd7fbffc12b Mon Sep 17 00:00:00 2001 From: Will Hopkins Date: Thu, 28 Dec 2023 11:38:51 -0800 Subject: [PATCH] fix: remove `ipairs` wrapping `node:iter_children` --- lua/hawtkeys/ts.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/hawtkeys/ts.lua b/lua/hawtkeys/ts.lua index e964139..94e8bd7 100644 --- a/lua/hawtkeys/ts.lua +++ b/lua/hawtkeys/ts.lua @@ -204,9 +204,8 @@ local function find_maps_in_file(filePath) if map.mode:match("^%s*{.*},?.*$") then local modes = {} - for i, child in - ipairs(node.node:child(1):iter_children()) - do + local i = 1 + for child in node.node:child(1):iter_children() do if i % 2 == 0 then local ty = vim.treesitter .get_node_text(child, fileContent) @@ -214,6 +213,7 @@ local function find_maps_in_file(filePath) :gsub("[\n\r]", "") table.insert(modes, ty) end + i = i + 1 end map.mode = table.concat(modes, ", ") end @@ -290,9 +290,8 @@ local function find_maps_in_file(filePath) if map.mode:match("^%s*{.*},?.*$") then local modes = {} - for i, child in - ipairs(node.node:child(1):iter_children()) - do + local i = 1 + for child in node.node:child(1):iter_children() do if i % 2 == 0 then local ty = vim.treesitter .get_node_text(child, fileContent) @@ -301,6 +300,7 @@ local function find_maps_in_file(filePath) -- vim.print("type: " .. vim.inspect(ty)) table.insert(modes, ty) end + i = i + 1 end map.mode = table.concat(modes, ", ") end