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.

Reply via email to