-
Notifications
You must be signed in to change notification settings - Fork 6
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
Mix Format: File triggers a full recompile #69
Comments
Can you paste some logs? In what way does it crash the running process? |
It does not crash. It just takes seconds to recompile the whole Elixir
project while it has already been compiled (server running in parallel).
What I do:
- I start a server: mix phx.server
- I format a file (the bottom drawer of Sublime Text opens and show the
compilation (without cache) of the whole application)
- I observe that my phoenix server is down when loading one of its webpage.
Here is the error message:
```
Compilation errorConsole output is shown below.
** (RuntimeError) could not compile application: fala.
You must restart your server after changing the following files:
* config/dev.exs
* config/config.exs
(phoenix 1.7.11) lib/phoenix/code_reloader/server.ex:236:
Phoenix.CodeReloader.Server.mix_compile_unless_stale_config/4
(phoenix 1.7.11) lib/phoenix/code_reloader/server.ex:188:
Phoenix.CodeReloader.Server.mix_compile/5
(phoenix 1.7.11) lib/phoenix/code_reloader/server.ex:74: anonymous
fn/4 in Phoenix.CodeReloader.Server.handle_call/3
(phoenix 1.7.11) lib/phoenix/code_reloader/server.ex:295:
Phoenix.CodeReloader.Server.proxy_io/1
(phoenix 1.7.11) lib/phoenix/code_reloader/server.ex:72:
Phoenix.CodeReloader.Server.handle_call/3
(stdlib 5.2) gen_server.erl:1131: :gen_server.try_handle_call/4
(stdlib 5.2) gen_server.erl:1160: :gen_server.handle_msg/6
(stdlib 5.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
```
…On Mon, 18 Mar 2024 at 10:33, Po Chen ***@***.***> wrote:
Can you paste some logs? In what way does it crash the running process?
—
Reply to this email directly, view it on GitHub
<#69 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPCQKAPVKNSLKXTWR567NDYY2YIJAVCNFSM6AAAAABE3F5VCKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBTGMZTCNZSG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
If you did just format one of the config files, it's required to restart the app by phoenix. If you formatted some other files and saw this, then it's a bug. |
Thanks for your fast reply. I did not change the config. It’s a bug 😕
…On Mon, 18 Mar 2024 at 13:10, Po Chen ***@***.***> wrote:
If you did just format one of the config files, it's required to restart
the app by phoenix. If you formatted some other files and saw this, then
it's a bug.
—
Reply to this email directly, view it on GitHub
<#69 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPCQKDHSFQVRP7LOUFDEV3YY3KRVAVCNFSM6AAAAABE3F5VCKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBTG42DIOJZG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Does it always happen or only the first time? |
Always. I mean, whenever I recompile the server, it recompiles for
formatting and vice-versa.
…On Tue, 19 Mar 2024 at 03:12, Po Chen ***@***.***> wrote:
Does it always happen or only the first time?
—
Reply to this email directly, view it on GitHub
<#69 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPCQKCHIFNAIOYPZAJY2QTYY6NJ5AVCNFSM6AAAAABE3F5VCKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBVGYYTGNRSHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Yeah, I think the issue is that Sublime and iTerm2 don't share the same environment. The Phoenix server is (most likely) compiled and started by the asdf-installed version of Elixir. I don't know about macOS, but you should be able to start Sublime from that iTerm2 shell to give it the same environment. I hope that's an acceptable workaround for now. I don't know what the proper solution would be yet. Maybe it is to make the There's something related that I noticed: I'm not using asdf, but when I run the tests from the CLI and then from Sublime it still compiles everything again, even though the Elixir version is the same. Quite annoying! I wish I had fun investigating this, but at the moment I'm busy with other things that are more fun. 😅 |
Another option is use LSP and LSP-elixir, so that you use the language server to format the code, instead of using the current app environment, which triggers recompilation. |
Using the LSP formatter works as expected. Thanks for the advice.
…On Wed, Mar 20, 2024 at 1:42 AM Po Chen ***@***.***> wrote:
Another option is use LSP and LSP-elixir, so that you use the language
server to format the code, instead of using the current app environment,
which triggers recompilation.
—
Reply to this email directly, view it on GitHub
<#69 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPCQKFSNY2DDI7QGO3ESK3YZDLNRAVCNFSM6AAAAABE3F5VCKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBYGQZDKMRZGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Using Sublime Text 4169 on macOS 14.4 and asdf (elixir 1.16.1-otp-26, erlang 26.2.2), formatting a file triggers a full app recompile (and crash the web server started with
mix phx.server
in parallel). I guess the compilation in Sublime and in iTerm2 do not share the same compilation environment.How to make sure Elixir Syntax uses the same compilation process as my default terminal?
Thanks
The text was updated successfully, but these errors were encountered: