jaredly / jaredly/reason-language-server

Incorrect compiler message parsing for ocaml >= 4.09

Open
#309 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
OCaml
Stars
649
Forks
85
PR merge metrics
No merged PRs in 30d

Description

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

The code to change seems to be in `AsYouType.re`:

https://github.com/jaredly/reason-language-server/blob/8f15f5d54dc8a46aede8d8ec4a77e6f1cbda78fb/src/analyze/AsYouType.re#L64-L78

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/analyze/AsYouType.re at lines 64-78 and compare its parsing with the OCaml >= 4.09 example in the issue. Use Tuareg's compilation message list as a reference; done means multiline messages include the first and last lines and interpret the second character position as the last-line position.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.