-
Notifications
You must be signed in to change notification settings - Fork 194
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
ElixirLS 0.19+ fails to compile projects with YamlElixir (and possible other) applications working at compile-time #1083
Comments
Projects described in OP can be compiled with My observation as of now, is that YamlElixir is not a pure library but an Erlang application, which requires its own application tree to work (storing configs, intermediate data, and whatnot). That may be related. |
It builds correctly on the first try
Then something gets unloaded and it crashes with a badmatch inside the lib
the error is mishandled in the library and returned as I don't know this lib nor what it is missing. ElixirLS tries to unload all apps, config and mix state and restart compilation with a clean slate. Maybe it's too aggressive (or not aggressive enough). It would be best if someone familiar with the library did some experiments. The code is in https://github.com/elixir-lsp/elixir-ls/blob/master/apps/language_server/lib/language_server/build.ex |
The error around this is what I have recreated in my debugging too. YamlElixir itself is a thin wrapper around Erlang library yamerl, and (badmatch and "malformed yaml" errors are mere fallback errors within YamlElixir's error handling routes) Does it gives enough context? I think YamlElixir/yamerl (and other possible affected apps) require access to application env, and that is what ElixirLS intercepts somehow? |
ElixirLS loads app env in a similar way to what mix does. Then after the build it attempts to cleanup everything. I guess it cleans some yamerl entries and the lib is not recreating them correctly. The problem does not affect mix as it gets a fresh OS process each time |
I'm Elixir person and open to provide fix, so I can tackle on the issue on my fork of YamlElixir. What could be the most natural/least resistant way forward? Should ideal yaml lib, if it is called at compile-time in ElixirLS environment and detects missing yamerl application state, "resurrect" yamerl app on-demand? Or, does ElixirLS have better tuning points to looking into? (I believe the most ideal yaml and other file codec library should be pure and brings no problems like this from the very first but anyway. yamerl is already a popular choice) |
@ymtszw It turned out that mix project reset was cleaning up app config yamerl but not unloading the app itself. On subsequent compiles it crashed due to no |
Thank you!
2024年5月4日(土) 14:26 Łukasz Samson ***@***.***>:
… @ymtszw <https://github.com/ymtszw> It turned out that mix project reset
was cleaning up app config yamerl but not unloading the app itself. On
subsequent compiles it crashed due to no :node_mods key in app env. I
addressed that by unloading all apps.
—
Reply to this email directly, view it on GitHub
<#1083 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABCML5VBI6AHQJ7GQV5OO23ZARWRPAVCNFSM6AAAAABFBJDCUGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJUGAZDMMBVGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Environment
Elixir 1.16.2 (compiled with Erlang/OTP 26)
Current behavior
As the title says, ElixirLS 0.19 onward fails to compile projects with YamlElixir application working at compile-time.
By "working at compile-time" I mean for instance, reading YAML-formatted config/data/etc. files and generate functions and modules from them.
Minimal repro repository here: https://github.com/ymtszw/repro
Example logs:
Repro steps:
mix deps.get
mix compile
lib/repro.ex
file in VSCode with the ElixirLS extension installedlib/repro.ex
and save the file. The error should appear then.Expected behavior
Compilations should succeed. At least it was compiled in version 0.18.x IIRC.
The text was updated successfully, but these errors were encountered: