Feature Request: Respect formatter plugins
axelson opened this issue · comments
Hi, thanks for Recode! It looks great!
I'm running into an issue when trying to use recode in a production application. When the elixir application depends on a formatter plugin (such as https://github.com/marcandre/freedom_formatter) then it appears that mix recode
formats the code without using that formatter plugin.
I've created a minimal reproduction of this issue:
https://github.com/axelson/recode_formatter_repro
Thanks for reporting this. I will take a look.
The problem is that Code.format_string!/2
ignores the option :plugins
. To fix this for recode
I will made PRs for recode
, rewrite
and sourceror
, the next days. Maybe I will make also a PR in the Elixir repo.
I have made two PRs that should solve this issue. You can try it in your recode_formatter_repo
with:
defp deps do
[
{:freedom_formatter, ">= 2.0.0", only: :dev},
{:recode, git: "https://github.com/hrzndhrn/recode", branch: "formatter"},
{:rewrite, git: "https://github.com/hrzndhrn/rewrite", branch: "formatter", override: true}
]
end
I will double check some things at the weekend and make the releases.
The solution is more a workaround. In rewrite
not all plugins will be respected but the FreedomFormatter
will be respected.
Thanks for the issue. I have learned some new things.
Have a nice weekend.
Thanks, I can confirm that my repro project works great after upgrading to recode 0.4.3 (and rewrite 0.4.2)! And it also work on a larger project as well, thank you! 👍