Repository navigation
Closed
Labels
apidebugDebug viewlet, configurations, breakpoints, adapter issuesfeature-requestRequest for new features or functionality
Description
We are looking into adding debug API to our vscode.d.ts. In order to design this as best as possible let's first look at the use cases and the current use of commands.
Use Cases
- Debug session end event Introduce a debugSessionEnds event #28234
- Node internal modules navigator
Commands
Extension --> VS Code
vscode.startDebug- extension can start a debug session by calling this commandcustomDebugRequest- extension can send any DAP request to the currently active debug adapterdebug.logToDebugConsole- extension can log a string to the debug console
VS Code --> Extension
startSessionCommand- if contributed vscode calls this command instead of starting a debug session on its owninitialConfigurations- if contributed vscode calls this command to get the initial content of thelaunch.json
Proposal
Minimal API proposal by Andre Weinand (@weinand) and me. If name and type should be a part of DebugSession is very coraleted to the question Andre Weinand (@weinand) raises below.
export namespace debug {
export const onDidEndDebugSession: Event<DebugSession>;
}
export interface DebugSession {
readonly name: string;
readonly type: string;
customRequest(requestName: string, args: any): Thenable<DebugRequestResult>;
}Metadata
Metadata
Assignees
Labels
apidebugDebug viewlet, configurations, breakpoints, adapter issuesfeature-requestRequest for new features or functionality
Activity
weinand commentedon Jun 12, 2017
One interesting question is: can a debugger extension only see the debug sessions that have the type introduced by the debugger extension or can it see all debug sessions of all types?
DanTup commentedon Jun 12, 2017
I'd like to be able to report status messages from the debug adapter back to the extension so that I can show text in the status bar. There are some things that would be really spammy to log to the debug output window (for example, I think in full-VS it shows in the status bar every DLL symbols are being loaded for during debugging?).
If status messages is a common requirement, maybe something like an additional channel for
OutputEvent(eg.status) would work, though being able to send complete custom messages (similar tocustomDebugRequestbut in the opposite direction) would be ideal, since an extension/debugger than have complete two-way communication (something some debug adapters have apparently implemented themselves by hosting endpoints and connecting back).isidorn commentedon Jun 13, 2017
Danny Tuppeny (@DanTup) thanks for the suggestion however we are taking this one step at a time, currently we are looking into what is the minimal set of APIs to make this good.
We will probably be focusing more on feature requests from next milestone onward
DanTup commentedon Jun 13, 2017
Isidor Nikolic (@isidorn) No worries; I figured it was worth you having the info even if you don't do anything with it for now (never hurts to have an idea of what people might want). My request is pretty minor tbh, the debugger just provides this info so I thought I'd look whether I could surface it anywhere.
isidorn commentedon Jun 23, 2017
We have introduced an initial API, more details #28234 (comment)
Andre Weinand (@weinand) should we close this issue, or leave it open as an umbrella item for future discussion regarding the debug API?
weinand commentedon Jun 23, 2017
We leave this open as the umbrella item for future discussions.
4 remaining items
weinand commentedon Nov 21, 2017
Henning Dieterichs (@hediet) currently we do not have official API for this but you can use this workaround:
You can pass in
evaluatetoDebugSession.customRequesthttps://github.com/Microsoft/vscode/blob/8ace097b59ea3180ff47353782ca7a9214b37530/src/vs/vscode.d.ts#L6049Pass the expression in this form https://github.com/Microsoft/vscode/blob/8ace097b59ea3180ff47353782ca7a9214b37530/src/vs/workbench/parts/debug/common/debugProtocol.d.ts#L882
The result has this format: https://github.com/Microsoft/vscode/blob/8ace097b59ea3180ff47353782ca7a9214b37530/src/vs/workbench/parts/debug/common/debugProtocol.d.ts#L900
hediet commentedon Nov 21, 2017
Andre Weinand (@weinand) thanks for your quick reply. However, running this code:
throws an exception with the message "not available" (I get the German error message "Nicht verfügbar").
I set
enableProposedApitotrueinpackage.jsonand made sure that there is an active debug session.Is there an event that fires when the debugger switches between running and pause mode?
I want to code an extension that can visualize expressions while debugging - if you want, a more graphical watch window.
weinand commentedon Nov 21, 2017
Yes, some debuggers can only "evaluate" if they are stopped.
Currently there is no API to track the debug status. Here is the corresponding feature request: #30810
BTW, It is no longer necessary to set "enableProposedApi" to true, since the API already lives in "vscode.d.ts" (and not vscode.proposed.d.ts").
hediet commentedon Nov 21, 2017
I always get this error (even if the debugger is stopped). In order to access the debug namespace, I had to copy the content from
vscode.d.tsof the github repository into thevscode.d.tsfile of the most recent (1.1.7)vscodepackage. I am using the most recent version of vs code (1.18.1). Maybe a bug?weinand commentedon Nov 21, 2017
Please update your vscode dependency in your package.json, e.g.:
and then delete node_modules folder and run
npm installagain.Or just run the
postinstallscript:What debugger extension are you using?
hediet commentedon Nov 21, 2017
I am using this
launch.json:{ "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "Launch Program", "program": "${workspaceFolder}/index.js" } ] }(the default nodejs debugger)
After deleting the node_modules folder and reinstalling all packages, it found the debug namespace - just changing the version in
package.jsonand runningnpm installdidn't do it. However, the error is still being thrown.hediet commentedon Feb 5, 2018
Are there any updates? I never managed to get it working (i.e. asking the debugging adapter to evaluate expressions). I am waiting for this feature for an awesome extension I want to prototype.
isidorn commentedon Feb 5, 2018
Henning Dieterichs (@hediet) we now support many new things in the debug api. You can find it here
Andre Weinand (@weinand) I see no use of keeping this issue open, thus closing it.
hediet commentedon Feb 5, 2018
Isidor Nikolic (@isidorn) I still don't see how to ask the debugger to evaluate a given expression. Did I miss something in the documentation?
isidorn commentedon Feb 5, 2018
Henning Dieterichs (@hediet) appologies, I misunderstood what you are exactly meaning to do. The evaluate request is still not a part of the API. For that one please create a brand new feature request so we have this on our radar. Thank you.
weinand commentedon Feb 6, 2018
The "Evaluate Debug API" discussion continues here: #42989