vscode-ocaml-platform icon indicating copy to clipboard operation
vscode-ocaml-platform copied to clipboard

Overly Broad Red Underline on Module Signature Mismatch

Open zevbo opened this issue 1 year ago • 1 comments

Currently, the linter underlines the entire module implementation when there is any mismatch in signature. This is problematic because (a) it makes it visually very hard to read what's going and (b) it overrides any other linting errors in the module. Take the following example:

0: module A : sig 
1:  type t 
2: end = struct
3:  type t = { field: InvalidSyntax }
4: end

Normally, one would expect InvalidSyntax to be underined on line 3. But here, the invalid syntax causes OCaml Platform not to know of any defined type t, therefore causing a module signature mismatch. As a result, everything from struct on line 2 to end on line 4 is underlined in red, and you can't see the specific underline under InvalidSyntax.

Thus, it would be helpful if the underline for module signature mismatch was much smaller--perhaps only on the struct keyword.

zevbo avatar Jul 22 '23 18:07 zevbo

cc @voodoos I imagine this would require some deeper changes in the error reporting of merlin and the compiler

rgrinberg avatar Sep 25 '23 23:09 rgrinberg