dgkf / debugadapter

Debug Adapter Protocol implementation for R

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature: verifying breakpoints when srcrefs are not found, auto-sourcing objects

dgkf opened this issue · comments

Placing a breakpoint in a file that hasn't been sourced currently causes the breakpoint to go un-verified, meaning that it is not traced.

Intuitively, this makes sense, as the code in the file can't be linked to code known in the interpreter to know which code to trace. But we can do better.

  • When attempting to verify a breakpoint with a known file path, but no known srcrefs exist for the file, we can source the file before attempting to set the breakpoint so that we can find which code to trace.
    • Sourced objects probably need to be loaded into the global environment... maybe there's a better way to hide them in a hidden environment (though I can't imagine how a user would know how to call them in such a scenario)?
    • To avoid sourcing a whole script, we might be able to parse it first, identify the expression containing the object to be traced and then source only that object to avoid unnecessary evaluation of possibly long-running code (ie, an analysis script with long data pull or transformation steps)
  • When attempting to verify code from a package which is not yet installed, we should emit a more meaningful message back to the client indicating that the package must be installed or is out of date.