I’ll work on a PR and will let you know if I have any questions. Thanks 😊
On Fri, 21 Jan 2022 at 22:44, José Valim <jose.va...@dashbit.co> wrote: > One option is to process the sigils formatter option early, so we pass > this option to the Surface formatter (which can then pass it to > format_to_string). In a nutshell, move this code > <https://github.com/elixir-lang/elixir/blob/b401d15296348e014e77863b1e3335176687a03d/lib/mix/lib/mix/tasks/format.ex#L540-L545> > to some place earlier in the stack. A PR is welcome! Feel free to ping if > you have any questions! > > On Fri, Jan 21, 2022 at 10:20 PM Jonatan Männchen <jona...@maennchen.ch> > wrote: > >> Hi All, >> >> I would like to propose the ability to format embedded elixir expressions >> inside of files / sigils being formatted by a formatter plugin. >> >> *Situation at the Moment* >> >> Formatter Plugins that format files which contain elixir expressions >> inside do not currently have a way to call the formatter again on the >> nested expression. >> >> *Example Usage* >> >> When using both surface <https://github.com/surface-ui/surface_formatter> >> and cldr_messages <https://github.com/elixir-cldr/cldr_messages>, one >> could write a file like this: >> >> <div> {gettext(~M"It's my cat's {year, selectordinal, one {#st} two {#nd} >> few {#rd} other {#th}} birthday!")} </div> >> >> The HTML should be formatted by the surface formatter, the M sigil by the >> cldr messages formatter. >> Since the surface formatter is currently using Code.format_string!/2, the >> cldr formatter is not applied. Reported to surface formatter as a bug here: >> https://github.com/surface-ui/surface_formatter/issues/60 >> >> I expect to see similar questions in formatter plugins like >> heex_formatter <https://github.com/feliperenan/heex_formatter>. >> >> *Possible Solution* >> >> It would be nice if there was an API, that would allow passing embedded >> elixir expressions back into the formatter. >> >> One way to achieve that, would be to pass a function >> to Mix.Tasks.Format.format/2 into opts. >> >> Thanks, >> Jony >> >> -- >> You received this message because you are subscribed to the Google Groups >> "elixir-lang-core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to elixir-lang-core+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-core/5b6b6721-c16e-480f-be95-8ef1a46dbb50n%40googlegroups.com >> <https://groups.google.com/d/msgid/elixir-lang-core/5b6b6721-c16e-480f-be95-8ef1a46dbb50n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "elixir-lang-core" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/elixir-lang-core/jFswzSUjsP4/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > elixir-lang-core+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2BQ7VwMr0%2BE2eVcFMpmbsaA3Vr5Ue3OOZbrEJErmRW_UA%40mail.gmail.com > <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2BQ7VwMr0%2BE2eVcFMpmbsaA3Vr5Ue3OOZbrEJErmRW_UA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CACupubMBqQ%3Djz6g2SMoNJhvKcaKJ_iML1XVnFZ4TpaPsYg_6jg%40mail.gmail.com.