elixir-lsp/elixir-ls

Compiler diagnostics for .exs files

amencarini opened this issue ยท 11 comments

Environment

  • Elixir & Erlang versions (elixir --version): 1.9.4, 22
  • Operating system: macOS 10.14.6
  • Client (editor or IDE): VS Code

Not sure if this is by design, but I'm not getting any hints when things are broken in .exs files. e.g.: If I have a typo calling a function in a test, this doesn't get reported in VS Code, I'll only notice when running the tests.

Hi @amencarini that is a known issue due to since .exs files are not handled the same as .ex files. It would probably be good to list this as a known issue on the readme.

While I understand .exs files aren't part of the compiled beam files, it would be great to have some feedback when you're referring incorrectly, say from a test, to a function that's part of the compiled beam files. Is this something that can be addressed at all? (I'm asking as I don't understand this well enough, not trying to demand this sorted ๐Ÿ™‚)

Offhand I'm not sure what would be involved in returning compilation errors for .exs files, but if you or anyone else would like to take a stab at supporting that, that would be very helpful!

There may be a resolution coming up upstream elixir-lang/elixir#10983

Hi!

Any known workarounds?

Just wanted to point out -- this isn't just tests. For a file like releases.exs, if you're missing comma you don't find out until you're deploying.

Thanks!

Thanks. Any specific "how to" would be most welcome!

kimko commented

As a workaround you can change your mixfile and force elixir to compile them.

+1 how do you force mix to compile the .exs files?

Thx!!

For .exs files, you can at least call Code.string_to_quoted to parse it and get at least syntax feedback.

For .exs files, you can at least call Code.string_to_quoted to parse it and get at least syntax feedback.

That's a good idea @josevalim

Parser diagnostics has been added in #986. Full compiler diagnostics are unlikely as it would require evaluating the client code in the context of language server