sketch-sh icon indicating copy to clipboard operation
sketch-sh copied to clipboard

Display warnings in in the editor

Open thangngoc89 opened this issue 6 years ago • 2 comments

Warnings aren't part of the compilation result, we need to teleport it out of console.log.

I have a reference implementation here for engine_native: https://github.com/Sketch-sh/sketch-sh/blob/8de00e725b390c09cd3523e4ff92b7d0849f1f67/engine_native/src/repl/Execute.re#L6-L31

You'll need to translate that code into OCaml and hook it into jsoo_main.ml in sketch's bucklescript fork

thangngoc89 avatar Jul 31 '19 12:07 thangngoc89

I started looking into this and found some challenges, as the functions required to do this were not available back in 4.02.3:

  • Location.warning_printer was introduced in 4.03: https://github.com/ocaml/ocaml/commit/f9ea209cb7dd08634917e332aba8c61962bc5168
  • Warnings.report was added in 4.06: https://github.com/ocaml/ocaml/commit/356d8a9c0c3439848444ec5dab7250c72b77ceeb

@thangngoc89 considering this, do you think it's easier to find a way to do this with the utils available in 4.02.3? Or rather try to compile jsoo_main in the browser with the latest 4.06 version?

jchavarri avatar Aug 09 '19 21:08 jchavarri

Or rather try to compile jsoo_main in the browser with the latest 4.06 version?

@jchavarri this isn't possible because bucklescript doesn't use opam switch's compiler-libs. I think there should be the same tools to do these things in ocaml 4.02.3

thangngoc89 avatar Aug 13 '19 17:08 thangngoc89

BuckleScript does not exist anymore and I don't think we will have the resources to build a brand new Sketch engine for ReScript anytime soon, so closing related issues.

jchavarri avatar Oct 07 '22 13:10 jchavarri