This extension is an API extension to help other extension track debug sessions. Other extensions can subscribe to get notifications on events occurring on debuggers they are interested in.
There have been a proliferation of debug trackers (I counted four) running within various extensions. They all cause many more event handlers for each message passing between various clients and the debug adapter, and these are generally redundant. Instead, this extension creates a single point where messages are filtered looking for events like start, stop, running, etc. Other extensions can subscript to this extension that can create more precise events.
VSCode does not provide a full complement of events. It only has an event for starting and terminating. There are things that occur prior to starting and one has to look into the messages, responses and events passing between VSCode and the debug adapter to synthesize other events. And looking at the many such trackers, the logic is sometimes incomplete. A continue event is also not generated all the time so, we have to synthesize it by looking at which commands are run that could potentially cause a continue
An extension can subscribe to all debug sessions of just the debug adapters that they are interested in. The selection of debug adapter is done via the
From a performance point of view, this extension can generate 3,000,000 events per second on a 2021 Intel MacBook Pro 16".
If we missed an event or if there is an error in our logic when synthesizing events, please let us know by filing and Issue or creating a PR.
We have versioned this API and aim to keep compatibility for the long term. If we cannot we will increment the version and will not drop support for older versions although fixes may only be done in the most recent version.
There are two ways you can use this API and both have the exact same interface. You can see the sample API here (do not use this, please get it from npm install where it will show up as exports.d.ts).
Build and Debug
Pre-requisites are that you have NodeJS (
Build the NPM library
We had trouble creating both an extension and a library from the same directory so we use build the library in an alternate directory. Somebody help us better organize this but for now, do this
The above generates a