-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Application modules list in app controller not reloaded after compile #13001
Comments
This is expected. The compiler will not stop, unload, load, and restart all applications that are currently running. It only compiles the new code. If you need updated application entries, then you need to stop, unload, load, and start them back up. :) |
@josevalim Then it is inconsistent behaviour as it loads the apps on the first compile, even if it is a noop
Even if that is intended then it is not easy to guess which apps need to be reloaded. The compiler is not returning that info and parsing stdout for |
@lukaszsamson you know the current application name and you can use I think that's not the main point though. The issue is that, if you start the runtime, then shutting all apps down and loading it all up will be very expensive. Restarting the VM will most likely be faster.
Yes, the current projects and dependencies have to be loaded for validation and other stuff. But we are not checking in any way if those definitions are current, stale, etc. We only ensure they are loaded. You can pass "--no-app-loading" if you really want to avoid loading it, but then you don't get |
Let me give more examples. Within the same VM instance, we won't check several things:
|
Well, that would explain some of the weirdness (e.g. the infamous |
What do you use it for?
Per above, unloading everything will be very expensive (and speaking from experience). And you will run into issues like, if there is a WebSocket connection, then you need to wait for the webserver timeout, etc. The best way would probably be to decouple the language server from the instance that compiles/builds the user code. Then, if necessary, you start a new instance at any time. Throwing everything out is typically faster than undoing and redoing. |
we rely on application controller being able to return app modules elixir loads apps only on initial compilation and and without purging we end up with outdated module list workaround elixir-lang/elixir#13001
To get application by module, to get a list of modules for completions (here's an example from iex elixir/lib/iex/lib/iex/autocomplete.ex Line 593 in a029cd2
That's unfortunate but as a general rule ElixirLS is not starting client apps (custom compilers are an exception), only loads.
Even if we go down this road I'd prefer to see a |
But in IEx we complement it with this, which will also show any loaded module, including ones which may be compiled in later: elixir/lib/iex/lib/iex/autocomplete.ex Line 571 in a029cd2
|
fixes an issue when workspace symbols would not see a newly added module due to app controller keeping old module list Workaround for elixir-lang/elixir#13001
fixes an issue when workspace symbols would not see a newly added module due to app controller keeping old module list Workaround for elixir-lang/elixir#13001
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:
mix new --sup app_modules_bug
cd app_modules_bug
lib/app_modules_bug.ex
AppModulesBug.Foo
toAppModulesBug.Bar
& saveNotice it returns the old module
AppModulesBug.Foo
and does not return the new moduleAppModulesBug.Bar
Expected behavior
I expect that after a successful compile app manifests for all generated apps will be reloaded and app controller will return correct app metadata
The text was updated successfully, but these errors were encountered: