ocaml-lsp
                                
                                
                                
                                    ocaml-lsp copied to clipboard
                            
                            
                            
                        Type error message
Current type mismatch message is hard to parse, e.g., on VS Code
and, especially, with larger types.
What do people think about a shorter (and formatted with markdown) message? For example, Intellij IDEA for Scala:
and
(might not be the best place to fix an error message, but this project seems more flexible to changes)
I could work on this if people like the idea.
It would be obviously nice to have this, but isn't there work in the compiler to provide structured type errors already? Ideally, we would just piggy back on that and format those structured errors as markdown.
Let's see what @trefis or @let-def recommend.
When merlin catches an error from the compiler it is already reasonably structured.
In this case we could pattern match on Expr_type_clash (...) and provide an alternative formatting. But adding more special cases is not really satisfying either.
I believe what @rgrinberg was referring to are some discussions from last summer (or the previous one?) about the compiler exposing errors as json objects, or something of the sort.
AFAICT no work has been done on that front, but I don't think there would be a strong opposition if you submitted a PR upstream (i.e. in the compiler) that implements that. Then merlin would get it for free (and we could backport it to older versions).