🖨️ A more flexible API to specify output target

Open
#150 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
ocaml
Domain
api

Research direction

Start with src/tty/Tty.ml around the display function referenced in the issue, then read the linked Asai/Tty display API and Nottui's Ui_loop.run entry point. Determine how a caller could provide its own formatter without manually wiring an out_channel, and document the intended API and its behavior for displaying diagnostics in a Nottui application.

Written by the indexing model from the issue text.

Description

design is needed

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.

Dominant language
OCaml
Stars
55
Forks
3
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RedPRL/asai

All issues in RedPRL/asai

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.