doorgan / sourceror

Utilities to manipulate Elixir source code
Apache License 2.0
316 stars 22 forks source link

improvement: allow modifications of `supertree` in `Zipper.within/2` #157

Closed zachdaniel closed 1 month ago

zachdaniel commented 2 months ago

We have our own version of within/2 in igniter for unrelated reasons, but I thought this improvement might be welcome.

We have a situation where we want to both:

  1. preserve the original location
  2. modify the "surrounding code".

By using the returned zipper's supertree (if present), we allow this kind of modification.

doorgan commented 2 months ago

This sounds good! Can we add a test for the use case?

zachdaniel commented 2 months ago

Can do :) I will add one next week.

zachdaniel commented 1 month ago

@doorgan done :)

doorgan commented 1 month ago

Awesome, thank you! 💜