-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debug API #28500
Comments
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? |
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 |
@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. |
@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. |
We have introduced an initial API, more details #28234 (comment) |
We leave this open as the umbrella item for future discussions. |
I just want to highlight this comment here. Say, my extension wants to send a custom command in response to a UI action. How does it know which debug session to send it to? |
In the July release there will be API to track the active debug session and to find out the type of the debug session. This makes it possible to send custom command only to those sessions, that are "owned" by your extension. |
Is it possible somehow for an extension to ask the debug adapter to evaluate a given expression? It would be great if such an API method was available. |
@hediet currently we do not have official API for this but you can use this workaround: You can pass in The result has this format: https://github.com/Microsoft/vscode/blob/8ace097b59ea3180ff47353782ca7a9214b37530/src/vs/workbench/parts/debug/common/debugProtocol.d.ts#L900 |
@weinand thanks for your quick reply. However, running this code: const result = await vscode.debug.activeDebugSession.customRequest(
"evaluate", { expression: "myexpression" }); throws an exception with the message "not available" (I get the German error message "Nicht verfügbar"). Is there an event that fires when the debugger switches between running and pause mode? |
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"). |
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 |
Please update your vscode dependency in your package.json, e.g.:
and then delete node_modules folder and run Or just run the
What debugger extension are you using? |
I am using this {
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/index.js"
}
]
} (the default nodejs debugger) |
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 I still don't see how to ask the debugger to evaluate a given expression. Did I miss something in the documentation? |
@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. |
The "Evaluate Debug API" discussion continues here: #42989 |
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
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 consoleVS 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 @weinand and me. If
name
andtype
should be a part ofDebugSession
is very coraleted to the question @weinand raises below.The text was updated successfully, but these errors were encountered: