We should probably call `format_elixir: true` and that sounds good to me. A PR is welcome!
On Thu, Jun 6, 2024 at 9:15 AM Aleksei Matiushkin < aleksei.matiush...@kantox.com> wrote: > Problem: > > when generating files with `Mix.Generator`, one should either be an expert > in whitespace, or explicitly run `File.write!(target_file, > Code.format_file!(target_file))` after the file has been generated. > > Solution: > > Accept `format: true` as another option in a call to > `Mix.Generator.copy_template/4` (technically, in a call to > `Mix.Generator.create_file/2` here > https://github.com/elixir-lang/elixir/blob/v1.16.3/lib/mix/lib/mix/generator.ex#L30 > which would call `Code.format_string/2` as in here: > https://github.com/elixir-lang/elixir/blob/v1.16.3/lib/elixir/lib/code.ex#L1014C17-L1014C32 > on content. > > If this fits, I can provide a PR. > > -- > —AM > > If passed, the resulting file would have been > > > -- > 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/4d590811-ca64-4328-95ee-c0f0472d9544n%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/4d590811-ca64-4328-95ee-c0f0472d9544n%40googlegroups.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/CAGnRm4JOiEgni_%3DDh6S2kcvLnjQVEG4CTb%3Dun%2BeSyC5%2B1BydBQ%40mail.gmail.com.