-
-
Notifications
You must be signed in to change notification settings - Fork 331
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
Multi-line status prompt ticker #3577
base: main
Are you sure you want to change the base?
Conversation
eb81ce7
to
64f8973
Compare
I think with a lot of worker threads we should explore in the future if we can provide a multi-column output, where we cut line count by a factor at the price of shortened output. |
Maybe we can fix the height for a given slot of time, e.g. 5 seconds. It can grow and shrink as needed, but should still feel stable enough due to the grace period. |
Code such as this one allows to be kept updated when the terminal dimensions change, as the jline call to get them can be costly (so you don't want to call it on every update of the prompt) |
One issue I hit with |
fixes #3546
This PR introduces a new
MultilinePromptLogger
that allows the status of multiple in-progress threads to be reported and viewed during a Mill evaluation:Screen.Recording.2024-09-19.at.2.29.11.PM.mov
MultilinePromptLogger
is basically a minimal translation of the currentticker
API to work with a multi-line prompt. There's probably a lot of other interesting improvements we can make now that we are multi-line, but this is a decent start that lets people know what their parallel build is doing. The UI works correctly both during scrolling and not-scrolling, and uses the same minimal ANSI codes that the existing ticker uses, so hopefully we won't hit any more edge cases that we aren't already hitting todayFrom an implementation perspective,
MultilinePromptLogger
is mostly a drop in replacement for the oldPrintLogger
, except:It prints multiple
ticker
lines at vertically at the bottom of the terminal, and has the logs printed aboveIt requires that you use
.endTicker()
after every.ticker("...")
call, so we can know where we should clear the ticker status (previously they always just got overriden by the next.ticker
call)We need to introduce a
withPaused{...}
block so that when you're running REPLs and stuff the prompt is not shownThe logger needs to extend
AutoCloseable
, since it uses a background thread to keep the prompt UI up to dateWe only can support logs which end with newlines. This means things like interactive progress bars and other ANSI magic won't work in the scrollback. This is a limitation of the current implementation that is hard to fix without going for more advanced techniques, but should be enough for the vast majority of logs and is a similar limitation as a lot of other tools.
Ticker max width is hardcoded to <120 characters wide, with longer ticker strings being shortened in the middle. This width is arbitrary but should hopefully work for most projects, and we can figure out how to make it configurable or dynamic in a follow up
I experimented with having the ticker logic live in the Mill client rather than server, which would make more sense, but we need the server to have the ability to enable/disable the ticker logic to run
console
and similar interactive tasks, and so it has to live in the serverThe old ticker remains available at
--disable-prompt
. Further improvements can come after 0.12.0.