Expert crashes when working on Elixir itself
Steps to reproduce:
- Clone https://github.com/elixir-lang/elixir and open
lib/elixir/lib/code/formatter.ex - Wait for lexical to report the compilation completed
- On your terminal, run
tail -f .lexical/lexical.log - Go back to your editor and try to trigger a completion like
Enum| - Check the logs, there is an error report:
17:24:01.897 [warning] ** (ArgumentError) could not call Module.get_attribute/2 because the module Code.Formatter is already compiled. Use the Module.__info__/1 callback or Code.fetch_docs/1 instead
(elixir 1.17.2) lib/module.ex:2350: Module.assert_not_compiled!/3
(elixir 1.17.2) lib/module.ex:1954: Module.get_attribute/7
(elixir 1.17.2) lib/kernel.ex:3727: Kernel.do_at/5
(elixir 1.17.2) expanding macro: Kernel.@/1
(elixir 1.17.2) nofile:2315: Code.Formatter.binary_operator?/1
(elixir 1.17.2) expanding macro: Kernel.in/2
(elixir 1.17.2) nofile:2315: Code.Formatter.binary_operator?/1
I'm running into this as well at work. I haven't dug into it yet, but may do so soon – if anyone has any theories, I'd love to hear them!
I'm not able to reproduce this error using nightly based on https://github.com/elixir-lang/expert/commit/c5cd0fc6d1ab6e85ac3f6943e490ed15171dc682:
I think this is more of an editor issue right now. Depending on if the editor supports workspace folders or how it determines the root folder.
I'm no longer able to reproduce this with the latest main. The logs in the original issue also turned out to be a red herring and not what was crashing expert back then, so I'm closing this.