Skip to content

Add smart stepping to skip unmapped generated code during stepping#347

Draft
Copilot wants to merge 3 commits into
masterfrom
copilot/explore-smart-stepping-support
Draft

Add smart stepping to skip unmapped generated code during stepping#347
Copilot wants to merge 3 commits into
masterfrom
copilot/explore-smart-stepping-support

Conversation

Copilot AI commented May 16, 2026

Copy link
Copy Markdown
Contributor

This PR adds feasibility-proven smart stepping support so stepping no longer gets stuck in transpiler/generated code that is not mapped back to user source. It also handles the roku-debug one-to-one remap case (no sourcemap present) as uninteresting code to step through.

  • Launch configuration

    • Added smartStep?: boolean to LaunchConfiguration.
    • Wired default normalization (false) in BrightScriptDebugSession.
  • Smart-step control flow in debug session

    • Added pending-step tracking for next, stepIn, and stepOut.
    • On suspend, when smartStep is enabled:
      • Detects whether the current generated line is “interesting” (mapped) or “uninteresting” (unmapped).
      • Automatically issues another step for uninteresting lines.
      • Emits StoppedEventReason.step once a mapped/interesting location is reached.
    • Clears smart-step state on continue/pause/restart and includes a max-attempt guard to prevent loops.
  • Source map line-coverage detection

    • Added SourceMapManager.generatedLineIsMapped(filePath, generatedLineNumber).
    • Uses source map mapping entries (generated-order) to determine whether a generated line is explicitly covered by mappings.
    • Caches mapped-line sets per sourcemap path.
  • No-sourcemap remap behavior

    • If no sourcemap exists for the staged file, smart-step checks whether getSourceLocation resolves to a different source file.
    • If so, it treats the current line as generated/uninteresting and keeps stepping (matching the requested one-to-one remap behavior).
// launch.json
{
  "type": "brightscript",
  "request": "launch",
  "smartStep": true
}

Copilot AI linked an issue May 16, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Explore adding support for smart stepping Add smart stepping to skip unmapped generated code during stepping May 16, 2026
Copilot AI requested a review from chrisdp May 16, 2026 01:24
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.

Smart stepping

2 participants