posit-dev / positron

Positron, a next-generation data science IDE
https://positron.posit.co
Other
2.79k stars 85 forks source link

Ark: Completions in a debug session should reflect the debug environment #3001

Open DavisVaughan opened 6 months ago

DavisVaughan commented 6 months ago

Right now, if you do debugonce(fn) and step into fn(), 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:

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)

jennybc commented 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.