fix: use length of path for insertion point, instead of node equality

This commit is contained in:
Zach Daniel 2024-07-22 13:59:32 -04:00
parent 11e948af6c
commit bfe50c6cac

View file

@ -149,7 +149,7 @@ defmodule Igniter.Code.Common do
cond do
upwards && extendable_block?(upwards.node) ->
{:__block__, _, upwards_code} = upwards.node
index = Enum.find_index(upwards_code, &(&1 == zipper.node))
index = Enum.count(zipper.path.left || [])
to_insert =
if extendable_block?(new_code) do
@ -170,7 +170,7 @@ defmodule Igniter.Code.Common do
super_upwards && extendable_block?(super_upwards.node) ->
{:__block__, _, upwards_code} = super_upwards.node
index = Enum.find_index(upwards_code, &(&1 == zipper.supertree.node))
index = Enum.count(zipper.supertree.path.left || [])
to_insert =
if extendable_block?(new_code) do