asai icon indicating copy to clipboard operation
asai copied to clipboard

🖨️ A more flexible API to specify output target

Open kentookura opened this issue 1 year ago • 10 comments

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 than display? I'd just like to pass my own formatter here: https://github.com/RedPRL/asai/blob/563566f2696ce258784215ba35bdd4ff89341410/src/tty/Tty.ml#L207

What I tried so far:

My best guess is to write a function display : Message.t Diagnostic.t -> ui, where ui is a wrapper around the image type of Notty. I could use the optional output argument of display, but it is not obvious to me how to hook the out_channel into my application. The toplevel of the UI is started by Ui_loop.run... which takes a Notty_unix.Term.t... into which I can pass an out_channel... This seems messy.

kentookura avatar Aug 07 '24 13:08 kentookura