Closed Wilfred closed 2 years ago
FWIW, you can see the end position in the Merlin protocol:
$ cat ~/scratch/type_error.ml
let f x: string = x + 1
$ cat ~/scratch/type_error.ml | ~/.opam/4.05.0/bin/ocamlmerlin single errors | jq .
{
"class": "return",
"value": [
{
"start": {
"line": 1,
"col": 18
},
"end": {
"line": 1,
"col": 23
},
"type": "typer",
"sub": [],
"valid": true,
"message": "This expression has type int but an expression was expected of type\n string"
}
],
"notifications": [],
"timing": {
"total": 1.9509999999999987,
"query": 0.13099999999999845,
"reader": 0.2289999999999992,
"ppx": 0.06199999999999939,
"typer": 1.5250000000000021,
"error": 0.0039999999999995595
}
}
I believe flycheck/flycheck#1400 would fix this.
Given the source code:
Flycheck highlights the current symbol, starting at the column position reported by merlin:
Region highlighting is controlled by
flycheck-highlighting-mode
. The default issymbols
, butsexps
has the same result in this example.M-x merlin-toggle-view-errors
highlights the exact expression instead. This is really helpful when dealing with errors in large functions.Is it possible to get this precise region highlighting with flycheck-ocaml?