-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
progress-addon #5251
progress-addon #5251
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
/** progress object interface */ | ||
export interface IProgress { | ||
state: 0 | 1 | 2 | 3 | 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could pull this into type ProgressState
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solved this by adding:
import type { ProgressState } from '../src/ProgressAddon';
It feels abit like a bad hack (cyclic import?), but works locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't be referencing src from typing files. The more isolated the better as otherwise it can cause huge problems since libraries will suddenly be looking at and maybe linting against our source code, not just the types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm yeah, good point. Gonna try to find a better workaround. Sadly enums are tricky to use with d.ts files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment below.
@Tyriar applied your remarks, up for review again. |
@Tyriar Found a way to borrow the emitter ctor from xterm until #5283 is resolved. With this change things are back to normal with only 1.4kB minified 💪 :
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just some small polish things
}); | ||
// FIXME: borrow emitter ctor from xterm, to be changed once #5283 is resolved | ||
this._onChange = new (terminal as any)._core._onData.constructor(); | ||
this.onChange = this._onChange!.event; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don' think the !
is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesnt work without. My guess - the any cast above keeps the undefined
as part of the type, so TS doesnt see this as undefined-guarded here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good, this is temporary
Co-authored-by: Daniel Imms <[email protected]>
* Progress state tracked by the addon. | ||
*/ | ||
export interface IProgressState { | ||
state: 0 | 1 | 2 | 3 | 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Tyriar Tried using a const enum inside the d.ts - this worked fine for TS itself and webpack build, but not with esbuild. So I changed it back to that integer union thingy. (Btw that plain union type is easier to understand for JS folks...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine 👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
Will try adopt in vscode now microsoft/vscode#237564
FYI in case you didn't see this kovidgoyal/kitty#8011 (comment) |
I see winget uses indeterminate progress, do you know of another application that implements value/% based? (cargo coming soon) |
Yeah, thats the reason why I had to exclude handling of OSC 9 that dont continue with
Nope, I dont. Systemd prolly uses that, but no clue in windows world. |
@Tyriar Yeah, debouncing might be needed. The sequence isnt all that good in its spec - it is also unclear, how long to show the progress indicator or when to remove it (I'd guess that it should be removed after some time of inactivity, or after a window focus toggle etc) |
In my implementation I considered clearing the state after a command is run. I guess it's kind of a necessity if the proc crashes/ctrl+c doesn't handle it, etc. |
I guess it needs a timeout running down, as we never know for sure when the terminal client app crashed or gave up for whatever reason. |
I have it clearing when shell integration tells us any command finished: microsoft/vscode@86b257e Seems like a fairly safe thing to do |
This addon implements ConEmu's progress sequence, for more context see #5250.
The addon tries to hide most of the sequence's shenanigans behind a convenient API:
Fixes #5250.