-
Notifications
You must be signed in to change notification settings - Fork 131
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
Proposal: Progress Events #92
Comments
A few small suggestions:
|
Re: Gregg's comments:
|
|
@chuckries thanks for this great proposal (and sorry for the long time it took me to respond to it). My comments:
Based on these comments, I've created a variant of your proposal. First the client capability (the client frontend signals to the DA that progress reporting is supported): /** Arguments for 'initialize' request. */
export interface InitializeRequestArguments {
// ...
/** Client supports progress reporting. */
supportsProgressReporting?: boolean;
} And now the three events: /** Event message for 'progressStart' event type.
The event signals that a long running operation is about to start and
provides additional information for the client to set up a corresponding progress and cancellation UI.
The client is free to delay the showing of the UI in order to reduce flicker.
*/
export interface ProgressStartEvent extends Event {
// event: 'progressStart';
body: {
/** An ID that must be used in subsequent 'progressUpdate' and 'progressEnd' events to make them refer to the same progress reporting. */
progressId: string;
/** Mandatory (short) title of the progress reporting. Shown in the UI to describe the long running operation. */
title: string;
/** The request ID that this progress report is related to. If specified a debug adapter is expected to emit
progress events for the long running request until the request has been either completed or cancelled.
If the request ID is omitted, the progress report is assumed to be related to some general activity of the debug adapter.
*/
requestId?: number;
/** If true, the request that reports progress may be canceled with a 'cancel' request.
So this property basically controls whether the client should use UX that supports cancellation.
Clients that don't support cancellation are allowed to ignore the setting.
*/
cancellable?: boolean;
/** Optional, more detailed progress message. */
message?: string;
/** Optional progress percentage to display (value range: 0 to 100). If omitted no percentage will be shown. */
percentage?: number;
};
} /** Event message for 'progressUpdate' event type.
The event signals that the progress reporting needs to updated with a new message and/or percentage.
The client does not have to update the UI immediately, but the clients needs to keep track of the message and/or percentage values.
*/
export interface ProgressUpdateEvent extends Event {
// event: 'progressUpdate';
body: {
/** The ID that was introduced in the initial 'progressStart' event. */
progressId: string;
/** Optional, more detailed progress message. If omitted, the previous message (if any) is used. */
message?: string;
/** Optional progress percentage to display (value range: 0 to 100). If omitted no percentage will be shown. */
percentage?: number;
};
} /** Event message for 'progressEnd' event type.
The event signals the end of the progress reporting with an optional final message.
*/
export interface ProgressEndEvent extends Event {
// event: 'progressEnd';
body: {
/** The ID that was introduced in the initial 'ProgressStartEvent'. */
progressId: string;
/** Optional, more detailed progress message. If omitted, the previous message (if any) is used. */
message?: string;
};
} /cc @gregg-miskelly @andrewcrawley @pieandcakes @DanTup @DonJayamanne @hbenl @isidorn please provide feedback from the client implementation perspective |
This sounds great to me! In Dart we already have a number of custom events sent from the debugger back to the extension to do just this, but ultimately I'd like the DA to be usable outside of Code, so the more VS Code-specific bits that move to standards, the better :-) I presume it's ok for |
This is perfect for pretty printing in js-debug as well, as formatting large minified scripts can take several seconds. That latest proposal would work well for us. |
If I'm not mistaken this new API allows the debugger to add progress messages. I.e. this isn't about just cancellable progress messages anymore, it's more generic. |
@weinand Thank you for the feedback! I appreciate your changes to the proposal. I am currently implementing this in the C# Extension for VS Code Debug Adapter. I will incorporate your changes into that implementation and I will report back as I discover issues and/or have new ideas/insights. |
@weinand from the client implementation side this proposal makes perfect sense. Also note that we can show progress in various places, for example debug viewlet or general workbench progress. I think we would noeed to decide on the location, or the event would have to specify this somehow. |
@weinand in case I wasn't clear, I suggest we don't commit this to the official protocol until I am done prototyping in the C# extension. Visual Studio's VS Code Debug Adapter Host is our target frontend for this. |
Yea, a way to provide priority or location for the progress may be useful. For instance, using the js-debug pretty printing example, in most cases it will take only a second or two so showing a notification would be a bit noisy, a loading indicator atop the debug view may be more appropriate. But for longer running tasks--like a hypothetical world we can offer to install Edge for the user if they don't have it already available--a notification would be appropriate. Maybe a property like |
Thanks a lot for the feedback. Here are some replies:
|
@weinand One part of my original proposal that I do not see in your revisions is the ability to cancel based on progressId (as opposed to the protocol sequence id). This is important to us for cancelling "generic" progress events that are not tied to a specific request. Specifically we need this for cancelling automatic symbol loading that occurs while the target process is running. My original proposal was to extend the CancelRequest to add an optional progressId field in order to cancel an outstanding progress operation. My idea would look something like this in protocol:
Did you have another idea for cancelling generic progress? Or can we amend your proposal to include the extension to CancelRequest? |
@chuckries yes, that was an oversight on my part. I think we can go with your proposal to add an additional attribute Here is why: But then I checked the spec and noticed that there is actually a misspelling that prevents the Due to this we are shipping the spec with an optional Given these lucky circumstances I propose the following:
|
This commit shows the (TypeScript) changes for the (experimental) progress support. |
I've released the DAP progress feature (and VS Code Insiders provides the UI for it; see microsoft/vscode#92253). |
@gjsjohnmurray thanks for letting me know. There are more than one of these issue in the doc. I'll have to fix the Markdown generator... |
@weinand I missed this initially but what was the purpose of making progressId a string as opposed to an int? |
We've started to represent IDs as strings because it makes it easier to use UUIDs. |
We propose that adapters can send progress events to a fronted, in order to display progress related UI to a user in the case of long running tasks on the adapter side. Specific examples of long running tasks that an adapter may want to report progress for include symbol loading and expression evaluation.
Progress events may be generic (unrelated to a specific request) or specific (related directly to a request). This allows frontends to organize incoming progress events and directly show progress UI or defer progress information to API related to an original request.
Progress events are grouped using a unique id. This allows adapters to report progress for a long running task and frontends to group progress events together.
Progress events can be cancellable and are cancelled by extending the existing CancelRequest.
CC: @andrewcrawley @gregg-miskelly
The text was updated successfully, but these errors were encountered: