Skip to content

Commit

Permalink
fix: remove ipairs wrapping node:iter_children
Browse files Browse the repository at this point in the history
  • Loading branch information
willothy committed Dec 28, 2023
1 parent fd487ed commit 4fc9322
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lua/hawtkeys/ts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,16 @@ 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)
:gsub("['\"]", "")
:gsub("[\n\r]", "")
table.insert(modes, ty)
end
i = i + 1
end
map.mode = table.concat(modes, ", ")
end
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 4fc9322

Please sign in to comment.