elixir-ls icon indicating copy to clipboard operation
elixir-ls copied to clipboard

Compiler diagnostics for .exs files

Open amencarini opened this issue 5 years ago • 10 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.

amencarini avatar Jan 05 '20 09:01 amencarini

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.

axelson avatar Jan 06 '20 18:01 axelson

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 🙂)

amencarini avatar Jan 06 '20 22:01 amencarini

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!

axelson avatar Jan 11 '20 19:01 axelson

There may be a resolution coming up upstream https://github.com/elixir-lang/elixir/issues/10983

lukaszsamson avatar May 22 '21 12:05 lukaszsamson

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!

lpender avatar Aug 05 '21 15:08 lpender

As a workaround you can change your mixfile and force elixir to compile them. Or you can hack elixir-ls to load exs files on build. We do that in debugger.

On 5 Aug 2021, at 17:28, Lee Pender @.***> wrote:

 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!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

lukaszsamson avatar Aug 05 '21 17:08 lukaszsamson

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

lpender avatar Aug 05 '21 20:08 lpender

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!!

kimko avatar Sep 21 '21 19:09 kimko

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

josevalim avatar May 30 '22 18:05 josevalim

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

lukaszsamson avatar May 30 '22 18:05 lukaszsamson

Parser diagnostics has been added in https://github.com/elixir-lsp/elixir-ls/pull/986. Full compiler diagnostics are unlikely as it would require evaluating the client code in the context of language server

lukaszsamson avatar Oct 02 '23 20:10 lukaszsamson