BetterErrors
BetterErrors copied to clipboard
Highlight file in terminal output
Babel just tokenizes the output and colours it. We could do the same and use the existing tokenizer of ocaml + some colours.
:+1:
To clarify: this is low-pri, because I feel the syntax highlighting will interfere visually with the actual error highlighting.
This is what babel uses. Look how neatly packaged this is. Definitely less friction to use than what's in the current ocaml ecosystem.
Are you saying that it's because it's so easy to install/make small modules? Or is it just a matter of library abundance?
It's all the thousand cuts really:
- The difficulty of thinking up this and search. I would have to know and think of using compiler libs; even the name sounds scary, huge and inaccessible to some programmers. What am I dealing with here? What are its dependencies? Any system-level stuff?
- Include. Current js workflow:
npm i js-tokens
, import. Current OCaml workflow: ... =[ - Use: I really don't wanna create a huge variant mapping token name to color. If I do, is it done for me already somewhere? Back to first point.
- Bundle. I hope compiler lib doesn't introduce some weird hard-to-solve deps? Which regex library does it use? I use the Pcre one.
- Publish: Js folks don't hesitate to publish these small libs, even e.g. this one which is super neat; for stripping ANSI in OCaml I'd inline it. Because who the heck submits a PR to opam whose content is a single line? I feel bad for submitting. Should I? How long will I wait? If it's more than five minutes it's already offset the amount of time I'll save by publishing & reusing it maybe twice ever.
(Note that I'm not necessarily for or against small libs. It does help with these points a bit though)