reasonml-idea-plugin icon indicating copy to clipboard operation
reasonml-idea-plugin copied to clipboard

Compiler output listener needs a change for ocaml >= 4.09

Open Khady opened this issue 5 years ago • 1 comments

I sent a change to the OCaml compiler to change the format of the error messages https://github.com/ocaml/ocaml/pull/8541. It means that messages printed by OCaml >= 4.09 won't be parsed properly by this LSP server.

The change affects the messages that are on multiple lines. The message now contains the first and last lines. Also the second part of the characters section is no longer a byte offset, it is the position on the last line.

Here is an exemple.

File "robustmatch.ml", lines 33-37, characters 6-23:
 9 | ......match t1, t2, x with
10 |       | AB, AB, A -> ()
11 |       | MAB, _, A -> ()
12 |       | _,  AB, B -> ()
13 |       | _, MAB, B -> ()
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
(AB, MAB, A)

I found two places where a change might be necessary:

https://github.com/reasonml-editor/reasonml-idea-plugin/blob/8a2820d8dedc45f3a93a11a563f8d71fcae2b22d/src/com/reason/build/bs/compiler/BsOutputListener.java#L26 https://github.com/reasonml-editor/reasonml-idea-plugin/blob/8a2820d8dedc45f3a93a11a563f8d71fcae2b22d/src/com/reason/build/dune/DuneOutputListener.java#L28

Tuareg has a list of compilation messages that can be used for reference: https://github.com/Chris00/tuareg/blob/master/compilation.txt

Khady avatar Jun 28 '19 07:06 Khady

Thanks for the reference. I'm not ready for ocaml >= 4.09 yet 😄

giraud avatar Jun 28 '19 15:06 giraud

should be ok

giraud avatar Apr 28 '23 14:04 giraud