Skip to content

Fix deferred capability handling for exception breakpoints#342

Merged
TwitchBronBron merged 3 commits into
masterfrom
fix-deferred-capabilities
May 15, 2026
Merged

Fix deferred capability handling for exception breakpoints#342
TwitchBronBron merged 3 commits into
masterfrom
fix-deferred-capabilities

Conversation

@chrisdp
Copy link
Copy Markdown
Collaborator

@chrisdp chrisdp commented May 13, 2026

Summary

PR #328 deferred the entire DAP capabilities payload to a post-connect CapabilitiesEvent, but VS Code reads exceptionBreakpointFilters exactly once from the initialize response — so the filters never appeared in the BREAKPOINTS panel.

Split the responsibilities:

  • initializeRequest surfaces the filter list (UI-driving, must be early)
  • post-connect CapabilitiesEvent carries the device-dependent booleans (supportsExceptionFilterOptions / supportsExceptionOptions, supportsConditionalBreakpoints, supportsHitConditionalBreakpoints, supportsLogPoints), which VS Code reads per-render so CapabilitiesEvent updates take effect

Adjacent fixes uncovered while testing

  • ProtocolCapabilities class — extract version-based capability checks from DebugProtocolClient. The adapter holds a fallback instance seeded from device-info brightscriptDebuggerVersion so we can answer capability questions before the protocol handshake completes. Some firmware versions support the debug protocol but omit brightscript-debugger-version from device-info, so the class also takes an optional softwareVersion and derives the protocol version from the Roku OS → protocol mapping when the device-info value is missing.
  • setExceptionBreakPointsRequest deadlock — was awaiting getRokuAdapter() which waits for the device to come online; that waits for publish(), which waits for configurationDone, which VS Code holds until we respond to this request. Switched to awaiting rokuAdapterDeferred.promise.
  • Exception breakpoint queue/replay — adapter queues filters when the debug protocol client hasn't connected yet, replays on connect.
  • _syncBreakpoints gating — now gates on this.connected and a proactive syncBreakpoints() runs on connect to flush queued breakpoints.

chrisdp and others added 3 commits May 13, 2026 19:28
PR #328 deferred the entire DAP capabilities payload to a post-connect
CapabilitiesEvent, but VS Code reads `exceptionBreakpointFilters` exactly
once from the initialize response - so the filters never appeared in the
BREAKPOINTS panel.

Split the responsibilities:
- `initializeRequest` surfaces the filter list (UI-driving, must be early)
- post-connect CapabilitiesEvent carries the device-dependent booleans
  (supportsExceptionFilterOptions/Options, supportsConditionalBreakpoints,
  supportsHitConditionalBreakpoints, supportsLogPoints), which VS Code
  reads per-render so CapabilitiesEvent updates take effect

Adjacent fixes uncovered while testing:
- ProtocolCapabilities class: extract version-based capability checks
  from DebugProtocolClient. Adapter holds a fallback instance seeded from
  device-info `brightscriptDebuggerVersion` so we can answer capability
  questions before the protocol handshake completes.
- setExceptionBreakPointsRequest deadlock: was awaiting `getRokuAdapter()`
  which waits for the device to come online; that waits for publish(),
  which waits for configurationDone, which VS Code holds until we respond
  to this request. Switched to awaiting `rokuAdapterDeferred.promise`.
- Adapter queues exception breakpoint filters when the debug protocol
  client hasn't connected yet, replays on connect.
- \`_syncBreakpoints\` now gates on \`this.connected\` and a proactive
  \`syncBreakpoints()\` runs on connect to flush queued breakpoints.
Some Roku firmware versions support the debug protocol but don't report
brightscript-debugger-version in device-info. ProtocolCapabilities now
takes an optional osVersion and falls back to the OS-to-protocol mapping
from the docs when the supplied protocol version is missing or invalid.
Copy link
Copy Markdown
Member

@TwitchBronBron TwitchBronBron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gave this a quick test, everything seems to be working fine. Nice!

@TwitchBronBron TwitchBronBron merged commit 85d7d3b into master May 15, 2026
7 checks passed
@TwitchBronBron TwitchBronBron deleted the fix-deferred-capabilities branch May 15, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants