-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Mix.Tasks.Format.formatter_for_file is broken in umbrella #12969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I cannot reproduce this behaviour. I got this in both cases: {#Function<12.58511805/1 in Mix.Tasks.Format.find_formatter_for_file/2>,
[
sigils: [H: #Function<29.58511805/2 in Mix.Tasks.Format.load_plugins/1>],
import_deps: [:ecto, :ecto_sql],
subdirectories: ["priv/*/migrations"],
plugins: [Phoenix.LiveView.HTMLFormatter],
inputs: ["*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}", Which seems correct to me and includes the relevant sigils. Info:
|
Keep in mind that latest Phoenix versions added this to the root mix.exs: defp deps do
[
# Required to run "mix format" on ~H/.heex files from the umbrella root
{:phoenix_live_view, ">= 0.0.0"}
]
end if you haven't updated phx.new, you may be missing it. |
I have that in root mix.exs and I am using phx.new v1.7.7
@josevalim you did reproduce it. Please notice
this comes from
from |
Hrm, thanks. I was mostly looking at the sigils. It seems we are getting mixed results then? |
@lukaszsamson ah, that was interesting, it only happens if one app name is the prefix of the other. A temporary fix for now is to swap the subdirectories order and have the longer name come first. I pushed a fix as well, please give it a try and thanks for the repro steps! |
I tried out the patch on 1.15 brnch and now it's working as expected. Thanks |
Sweeeeeeeeeet, thanks! |
Elixir and Erlang/OTP versions
Erlang/OTP 26 [erts-14.0.2] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]
Elixir 1.15.6 (compiled with Erlang/OTP 26)
Operating system
macOS
Current behavior
Repro:
Observe that returned formatter options are for the wrong umbrella app. Instead of options for formatter_umbrella_web formatter_umbrella is returned. If you make an edit to
apps/formatter_umbrella/.formatter.exs
and e.g. removeplugins
and get options again it will return invalid optionsthe returned function will not be able to format contents of ~H.
Interestingly, this is able to format correctly
Expected behavior
The function should work correctly in umbrella apps
The text was updated successfully, but these errors were encountered: