ash-project / igniter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Identation whitespace is removed from files when installing packages with `mix igniter.install`

laznic opened this issue · comments

Describe the bug
When you run mix igniter.install <package>, it asks you to confirm the required dependency changes in order the install everything. This results in idendation whitespace being removed in front of every line in few configuration files. It only removes the whitespace from the following files (using Phoenix):

  • mix.exs
  • .formatter.exs
  • config/config.exs
  • config/dev.exs

To Reproduce

mix igniter.install dotenv

Expected behavior
Package gets installed without whitespace being removed from files.

Runtime

  • Elixir version: 1.17
  • Erlang version: Erlang/OTP 27
  • OS: Windows (WSL2)
  • Igniter version: 0.1.4

Additional context
image
image

Something is definitely strange here. This doesn't happen for me, I'm unable to reproduce, but I haven't set up a new phoenix project and attempted it, it could be some kind of syntax error that we're introducing causing this? Even then, it seems strange. What version of sourceror is in your mix.lock? I'm wondering if this is a windows issue potentially?

Are you using WSL on windows?

sourceror seems to be on version 1.2.1 and yes, I'm using WSL on Windows.

🤔 Is your project open source that I could try this out with? Or could you provide a reproduction project?

Sure thing, I changed the project to be public for the time being since it only has the initial Phoenix setup with some extra deps. It can be found here: https://github.com/laznic/tournament-manager

Thank you! I can confirm the issue happens for me as well. I'll look into it in the next day or two :)

Strangely enough, the "cause" here appears to have something to do with the Phoenix.LiveView.HTMLFormatter 😆 I think this may be a bug in one of our underlying tools potentially incorrectly applying the formatter.

Alright, we'll need a fix to be merged in rewrite here: hrzndhrn/rewrite#35. Once that is merged we can update igniter's dependency requirement and things should be good to go :)

I've ported the fix to igniter for now :) Fix applied in v0.1.6

Thank you so much for the quick fix! Tried it out and it's perfect 🎉 Can't wait to start using Igniter more deeply!