ocaml-lsp icon indicating copy to clipboard operation
ocaml-lsp copied to clipboard

Show parsed ocamlformat syntax error message

Open ulugbekna opened this issue 3 years ago • 5 comments

The biggest quality of life improvement in editing ocaml code on vscode achievable in 8 lines IMHO

before:

image image

after:

image

Better solutions exist where we

  • add a custom notification if client supports to add a button to the pop-up to jump to the error
  • add a status bar item in vscode that shows the formatting didn't succeed and clicking on the item, one can jump to the place of error

ulugbekna avatar Jun 13 '22 21:06 ulugbekna

It's an improvement, but it's a bit of a shame it has to be done this way. Have you considered the following solution:

  • Set the env var INSIDE_OCAMLLSP when running ocamlformat
  • Modify ocamlformat to output decent errors when this happens.

rgrinberg avatar Jun 17 '22 17:06 rgrinberg

It's an improvement, but it's a bit of a shame it has to be done this way. Have you considered the following solution:

Do you mean submitting a patch to ocamlformat to have better errors?

ulugbekna avatar Jun 17 '22 18:06 ulugbekna

Yeah, exactly.

rgrinberg avatar Jun 17 '22 18:06 rgrinberg

Is it worth merging this PR before we make a PR to ofmt and they release a new version?

It's a big QoL improvement imho

ulugbekna avatar Jun 20 '22 21:06 ulugbekna

Tbh, it never bothered me. I'm also worried that we're going to mangle some potential errors if they change some things. Since we need to support more than one version of ocamlformat.

rgrinberg avatar Jun 20 '22 23:06 rgrinberg