ferd / erl_subgraph_compile

A rebar plugin to only do partial re-builds of some files without any safety checks.
Apache License 2.0
9 stars 1 forks source link

Return diagnostics in case of compiler error for integration with Erlang LS #4

Open robertoaloi opened 4 years ago

robertoaloi commented 4 years ago

In case of a compilation error, the error is currently printed out via rebar_api:info/2 and then rebar_api:abort/0 is called. From a Language Server perspective, where the plugin is not invoked from command line, but via the Erlang API:

rebar3:run(State, ["erl_subgraph_compile", "-f", Filename]).

It would be much more convenient to obtain the compiler errors in raw format, so they can be published as diagnostics.

Also see the els_compiler_diagnostics module to see how compiler results are currently converted to diagnostics in Erlang LS.

ferd commented 4 years ago

Noted. I should be able to detect whether we're started in API mode or not and adapt output accordingly.

robertoaloi commented 4 years ago

Also, the Build Server Protocol has an initialized notification that can be used "to initialize intensive computation such as dependency resolution or compilation. The initialized notification may only be sent once."

Something we could leverage. See: https://build-server-protocol.github.io/docs/specification#initialized-build-notification