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.

Reply via email to