Is it possible to write an extension for Visual Studio Code that is informed of changes in the state of the VS Code debugger? The @vscode/debugadapter
and vscode-debugprotocol
packages give some hints but no obvious direction.
The use-case would be that when debugging is started (say of a Python script) the extension is notified 'DebuggingStarted' and when the debug session ends a 'DebuggingEnded' notification is received.
https://code.visualstudio.com/api/references/vscode-api#debug
It has a onDidStartDebugSession and onDidTerminateDebugSession.
You use it like this in your extension's activate function:
context.subscriptions.push(vscode.debug.onDidTerminateDebugSession(async (e: vscode.DebugSession) => {
console.log("Terminated Debug Session!");
}));