Since #217, cdt-gdb-vscode contributes some menu entries that are exclusive to the specific debug types gdb and gdbtarget of cdt-gdb-adapter (using conditions like "when": "debugType == gdb || debugType == gdbtarget",), but would also be useful for debug adapters derived from cdt-gdb-adapter by adopters (such as me/Indel) in their own extensions under their own debug types. Add a way for such extensions to participate in any such functionality provided by cdt-gdb-vscode, without requiring changes to cdt-gdb-vscode itself.
I am willing to implement this, since it affects me, but I don’t have it ready yet for a PR, and since we are already starting discussing it, I am opening this issue to collect the discussion.
How to do this?
In #217 (review), @jreineckearm writes:
Was thinking about the hard-coded adapter types: guess simplest way would be to create a context variable like cdt.debug.isSupportedAdapter which gets updated on each active session change. Then at least the when conditions wouldn't need to be touched for adapters derived from gdb/gdbtarget.
I was thinking of adding a context variable cdt.debug.debugTypes, so that the when conditions would become debugType in cdt.debug.debugTypes. Initially it would contain ['gdb', 'gdbtarget'], but cdt-gdb-vscode would offer an API for other extensions to add their own types to it. That call would also do any registrations that cdt-gdb-vscode by itself only does for gdb and gdbtarget also for the additional type (currently none, but we were talking about some in #208 before that was solved differently).
How would your active session change handler know whether the new session is cdt-gdb-adapter-derived? Also, we may not always only care about the active session: Assuming one can add context menu items on debug sessions (I didn’t check), then the context for such an item should be the session that the user clicked on, not the active one.
Since #217, cdt-gdb-vscode contributes some menu entries that are exclusive to the specific debug types
gdbandgdbtargetof cdt-gdb-adapter (using conditions like"when": "debugType == gdb || debugType == gdbtarget",), but would also be useful for debug adapters derived from cdt-gdb-adapter by adopters (such as me/Indel) in their own extensions under their own debug types. Add a way for such extensions to participate in any such functionality provided by cdt-gdb-vscode, without requiring changes to cdt-gdb-vscode itself.I am willing to implement this, since it affects me, but I don’t have it ready yet for a PR, and since we are already starting discussing it, I am opening this issue to collect the discussion.
How to do this?
In #217 (review), @jreineckearm writes:
I was thinking of adding a context variable
cdt.debug.debugTypes, so that the when conditions would becomedebugType in cdt.debug.debugTypes. Initially it would contain['gdb', 'gdbtarget'], but cdt-gdb-vscode would offer an API for other extensions to add their own types to it. That call would also do any registrations that cdt-gdb-vscode by itself only does forgdbandgdbtargetalso for the additional type (currently none, but we were talking about some in #208 before that was solved differently).How would your active session change handler know whether the new session is cdt-gdb-adapter-derived? Also, we may not always only care about the active session: Assuming one can add context menu items on debug sessions (I didn’t check), then the context for such an item should be the session that the user clicked on, not the active one.