-
Notifications
You must be signed in to change notification settings - Fork 2
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
🖨️ A more flexible API to specify output target #150
Comments
I might drop Notty as well, but I am still interested in a slightly more flexible API. |
@kentookura I agree the API is not great. The fundamental design headache is that OCaml does not provide a "universal I/O streams". Therefore, many libraries are forced to come up with their own interface to accept standard https://erratique.ch/software/uutf/doc/Uutf/index.html#type-dst I suppose we could generalize out the |
@kentookura BTW, I don't immediately see how this can help your integration with Notty. Notty's formatter does not accept control characters at all, but we are sending out control characters directly. Therefore, if you plug Notty's formatter into the |
I am no longer using Notty, so that whole headache is gone. |
@kentookura Alright, I'm closing this as "WONTFIX" then. |
Sure, but I am still interested in discussing a more flexible API in general. |
@kentookura Alright. In general, the difficulty is to choose this "universal output stream" type. Some libraries define their own solutions. Sadly the standard library lacks one. |
I thought I might have another use case for this, namely compiling with (End result: https://mikeshulman.github.io/jsnarya/. As you can see, the ANSI colors and highlighting work fine too.) |
Thought of this issue when reading this: |
I am experimenting with Nottui and would like to display diagnostics in my application. I am aware that terminal rendering used to be handled with notty.
From looking at the code in
Tty
, maybe this can be achieved by just exposing function that is a bit more flexible thandisplay
?I'd just like to pass my own formatter here:
asai/src/tty/Tty.ml
Line 207 in 563566f
What I tried so far:
My best guess is to write a function
display : Message.t Diagnostic.t -> ui
, whereui
is a wrapper around theimage
type of Notty. I could use the optionaloutput
argument ofdisplay
, but it is not obvious to me how to hook theout_channel
into my application. The toplevel of the UI is started byUi_loop.run
... which takes aNotty_unix.Term.t
... into which I can pass anout_channel
... This seems messy.The text was updated successfully, but these errors were encountered: