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

Most upvoted comments