zenchild

zenchild

Igniter.Code.Common.move_to_cursor returns error

I’m trying to get Igniter.Code.Common.move_to_cursor to work for some code patching and I’m having trouble. I keep getting an :error returned. I then tried to run the demo code from the docs and that is also returning :error. Is there any work-arounds or maybe I’m just doing something wrong (probably :slight_smile: )?

Igniter version: igniter 0.5.50
Elixir version: Elixir 1.18.1 (compiled with Erlang/OTP 27)
OS: OSX

zipper =
  """
  if true do
    10
  end
  """
  |> Sourceror.Zipper.zip()

pattern =
  """
  if __ do
    __cursor__()
  end
  """

Igniter.Code.Common.move_to_cursor(zipper, pattern)
# returns :error

Many thanks for any help.

Cheers,

Dan

First Post!

zenchild

zenchild

It appears to maybe just be an error in the documentation, I was able to get the example to work by parsing the string first.

zipper =
  """
  if true do
    10
  end
  """
  |> Sourceror.parse_string!()
  |> Sourceror.Zipper.zip()

Most Liked

zenchild

zenchild

Thanks for the tips. I’m just going to put it below a know function for now. :+1:

Where Next?

Popular in Questions Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New