vscode: Expose DAP IDs of breakpoints in vscode API
For performance profiling, we let users pick the breakpoints to run to. For this I need to know the DAP ID of the breakpoint, since that’s what my debug adapter, in turn, knows about. However, the breakpoint IDs exposed on the API only have a GUID which does not seem correlated with anything else.
In the past I got around this by just having a custom “get breakpoints” request through DAP that returned the breakpoints from the debug adapter and we can show the right UI. But with Jackson’s good suggestion here https://github.com/microsoft/vscode/issues/96473#issuecomment-638510505 I now also want to get the file URI of the breakpoint to show it as a preview.
This ultimately means I need to either redo the URI-generation behavior, or have logic to correlate my DAP breakpoints with debug breakpoints. I ended up doing the latter, but it would be much nicer if breakpoints had some API like:
getDapIdInSession(session: DebugSession): string | undefined;
My current hack-around: https://github.com/microsoft/vscode-js-debug/blob/88e380e64f5bac3a722f879a95793e2688bd4062/src/ui/profiling/breakpointTerminationCondition.ts#L58-L71
const vscodeBp = vscode.debug.breakpoints.find(
(bp): bp is vscode.SourceBreakpoint =>
bp instanceof vscode.SourceBreakpoint &&
bp.enabled &&
bp.location.range.start.line === line - 1 &&
comparePathsWithoutCasingOrSlashes(bp.location.uri.fsPath, path),
);
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (15 by maintainers)
Commits related to this issue
- feat: preview the location of the breakpoint in perf selection See https://github.com/microsoft/vscode/issues/96473#issuecomment-638588819 Fixes https://github.com/microsoft/vscode-js-debug/issues/51... — committed to microsoft/vscode-js-debug by connor4312 4 years ago
- add API to access DAP breakpoints; see #99716 — committed to microsoft/vscode by weinand 4 years ago
- debug: getDebugProtocolBreakpoint: make sure to use the breakpoint id #99716 — committed to microsoft/vscode by isidorn 4 years ago
- add API to access DAP breakpoints; see #99716 — committed to gjsjohnmurray/vscode by weinand 4 years ago
- debug: getDebugProtocolBreakpoint: make sure to use the breakpoint id #99716 — committed to gjsjohnmurray/vscode by isidorn 4 years ago
I’ve planned to investigate in July what to do here.
The final proposed API which is now ready for finalisation: https://github.com/microsoft/vscode/blob/b0f0a1bf81b876e8f400b29fa88aa5e3413d67cd/src/vs/vscode.proposed.d.ts#L740-L756
I’ve adopted this in https://github.com/microsoft/vscode-js-debug/commit/2540489141266333db7d155d9d8ff345da25fae9#diff-f44b7dbc3c9b27f609323871139f7d34, seems to work very nicely 🙂