I know I can send custom request to the debug adapter using vscode.debug.activeDebugSession?.customRequest(command). But what if I want to listen for an event such as Stopped Event?
For custom events, use this:
vscode.debug.onDidReceiveDebugSessionCustomEvent(event => {
    if(event.event == 'stopped') {
        // ...
    }
})
For events intercepted by vscode, you might want to check this answer instead:
The solution for this is called a
DebugAdapterTracker.vscode.debug.registerDebugAdapterTrackerFactory('*', { createDebugAdapterTracker(session: DebugSession) { return { onWillReceiveMessage: m => console.log(`> ${JSON.stringify(m, undefined, 2)}`), onDidSendMessage: m => console.log(`< ${JSON.stringify(m, undefined, 2)}`) }; } });https://code.visualstudio.com/updates/v1_30#_extension-authoring
Look for "Finalized Debug Adapter Tracker API". It was originally created for Live Share debugging.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With