r-lib / debugme

Easy and efficient debugging for R packages
https://r-lib.github.io/debugme/
Other
147 stars 10 forks source link

Support going to the code #13

Open gaborcsardi opened 7 years ago

gaborcsardi commented 7 years ago

We could add ids to the debug messages somehow, and then jump to their place in the code quickly, either just showing the code on the screen like tracer, or jumping there in RStudio.

gaborcsardi commented 6 years ago

As a first step, we could just include the file name and line number of the source code.

krlmlr commented 3 years ago

I think file+line information is only available from the parse data? This seems incompatible with the way we instrument now.

If we changed to instrumenting the parse data, we could switch to instrumenting comments (#35), this gives true zero-cost debugging. Would you support that?

gaborcsardi commented 3 years ago

If the installed package has source references, then there is file + line information, I think.

krlmlr commented 3 years ago

Yes, we have parse data. But if we walk the language tree, we don't get the source references for every token, AFAICT. Do we need to change pkgload?

gaborcsardi commented 3 years ago

E.g. covr walks the language tree and uses the source refs to for every expression, so I think it is possible to do it.

Might not be worth it, though.

krlmlr commented 3 years ago

Yeah, covr sees internal srcrefs for calls, and can impute them for control flow constructs -- we have strings. But we could search for these strings in the parse data! Not sure about " vs., ', it's worth a try.

Still, instrumenting the parse data and using comments would be much better.