Skip to content
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

Elixir formatter not using project .formatter.exs file #232

Closed
NickBoyadjian opened this issue Oct 26, 2023 · 5 comments · Fixed by #239
Closed

Elixir formatter not using project .formatter.exs file #232

NickBoyadjian opened this issue Oct 26, 2023 · 5 comments · Fixed by #239

Comments

@NickBoyadjian
Copy link

When formatting a file within a project that has a .formatter.exs file, apheleia is not using this config to format the file.

@raxod502
Copy link
Member

Is it expected behavior to use such a file if it's present? Can you point to some documentation that explains what Apheleia should be doing? I'm not familiar with the Elixir ecosystem.

@NickBoyadjian
Copy link
Author

I definitely think that would be the expected behavior. If you check out these docs, you can see that the default is to read from the .formatter.exs file.

https://hexdocs.pm/mix/main/Mix.Tasks.Format.html

The main issue is that when saving a file, apheleia runs the "mix format" command from the directory that the current open buffer is in, rather than the project root directory.

@raxod502
Copy link
Member

raxod502 commented Nov 4, 2023

Maybe something like #239? (I haven't tested it, I don't have an Elixir toolchain installed locally.)

@NickBoyadjian
Copy link
Author

That's awesome, thank you! I just tested it in my emacs and it worked perfectly :D

raxod502 added a commit that referenced this issue Nov 12, 2023
Make it so that if there is a `.formatter.exs` file somewhere in the
parent directories, then Apheleia will run `mix format` from there
instead of the current directory.

Close #232
@raxod502
Copy link
Member

Fantastic, merged :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants