Open DavisVaughan opened 6 months ago
My recent puzzlement in the debugger, while working on .ps.help.showHelpTopic()
is part of what inspired this. To add a bit more color, I think what's so baffling about the fact that the LSP helps with completions that cannot then be evaluated is that I think most users assume that "R helped me complete this thing, therefore this thing is in scope". Which the current situation violates.
Right now, if you do
debugonce(fn)
and step intofn()
, then the Debug Variables pane will show you variables that are relevant to that debug environment, but if you start typing in the Console then you will see completions that are relevant for the global environment rather than your debug environment.This is obviously not correct, for a few reasons:
match <- 1:5
, then our autocompletion engine will help you completematch()
, with the parens, because it thinks you are in the global env.ps.help.showHelpTopic()
, which run in a child of the base env, then you will get completions for things likestr()
even though that is from utils and you can't actually even call it withoututils::str()
We do capture the environment of the debug frame, so we've got that information to pass on to the completion engine. The tough part is plumbing it over there.
We probably need some central location of session level information that allows for updating bits and pieces of the session level information stored there - like the active console environment, which could then be queried by other parts of the code, like the completion engine (or even the standard Variables pane, but right now we've decided that that should always show the global env)