-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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
Introduce a debugSessionEnds event #28234
Comments
The idea here is that vscode extensions can listen on this event? Should this then be part of the vscode api? I feel this makes sense but what is the use case? Instead of using a session ID we can just use the name of the launch config, since we use that as a sort of an ID. |
To conform with our current API we could go with something like the following. export namespace debug {
export const onDidEndDebugSession<DebugSessionData>;
export const onDidChangeDebugState<string>;
} |
Instead of "DebugSessionData" we need a type (interface) Since VS Code supports concurrent debug sessions, I don't think that "debug state" changes make a lot of sense without debug sessions. So the So my proposal: export namespace debug {
export const onDidEndDebugSession: Event<DebugSession>;
export const onDidChangeDebugState: Event<DebugSessionStateChangeEvent>;
}
export interface DebugSession {
readonly name: string;
customRequest(requestName: string, args: any): Thenable<DebugRequestResult>;
}
export interface DebugSessionStateChangeEvent {
debugSession: DebugSession;
newState: string;
} |
Currently on the vscode implementation side just a
We can always start minimal as you already proposed. I will sync up with Joh on monday to get his thoughts on this. |
Relying on an implicit "focused debug session" is neither robust nor easy to use. Extension code would have to figure out what the "focused debug session" is in order to know where the state change has happened. Due to race conditions there is no guarantee that the "focused debug session" is still the one for which the state change event was delivered. So it is better to keep them together. BTW, we probably need an |
We will now continue the discussion about the general debug API in #28500. |
Regarding the use case. I'm writing an extension (vs-kubernetes) which does some debugger setup work (setups port-forwarding) and then makes a call to an existing debugger (e.g. the nodejs debugger). The nodejs debugger (which I didn't write) spins up and debugs my app. But, when the user terminates the debugger, I want to tear down the port forwarding, but I don't have an event I can listen to, to trigger this tear down. I know that I could write my own debugger that wraps the node debugger and get this interface, but that really shouldn't be necesary (and is a support burden since I want to support so many different langauges...) |
@brendandburns Is it correct that you call into an existing debugger by using the If we give you a Our current thinking is that the Alternatively you can replace the |
BTW, for May I've explored something that looks similar to the issue you are trying to solve: #26205 |
@brendandburns I've added proposed API for tracking termination of debug sessions. You can find the API here: https://github.com/Microsoft/vscode/blob/master/src/vs/vscode.proposed.d.ts#L472 See my comment from above for the two possible approaches to use the API. In order to use proposed API, you must opt into it by adding a /cc @chrisdias |
Currently it is easy to track newly created debug sessions in an extension but it is not possible to track when a session ends.
things to consider:
The text was updated successfully, but these errors were encountered: