Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight the exact region reported by merlin #12

Closed
Wilfred opened this issue Nov 23, 2018 · 2 comments
Closed

Highlight the exact region reported by merlin #12

Wilfred opened this issue Nov 23, 2018 · 2 comments

Comments

@Wilfred
Copy link

Wilfred commented Nov 23, 2018

Given the source code:

let f x: string = x + 1

Flycheck highlights the current symbol, starting at the column position reported by merlin:

screen shot 2018-11-23 at 16 30 59

Region highlighting is controlled by flycheck-highlighting-mode. The default is symbols, but sexps 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.

screen shot 2018-11-23 at 16 21 29

Is it possible to get this precise region highlighting with flycheck-ocaml?

@Wilfred
Copy link
Author

Wilfred commented Nov 23, 2018

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
  }
}

@fmdkdd
Copy link
Member

fmdkdd commented Nov 26, 2018

I believe flycheck/flycheck#1400 would fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants