REditorSupport / vscode-R

R Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=REditorSupport.r
MIT License
1.07k stars 128 forks source link

"Launch RStudio Addin" does not work when R session is not attached. #600

Closed jooyoungseo closed 3 years ago

jooyoungseo commented 3 years ago

"Launch RStudio Addin" works only when R is explicitly attached to current R/Rmd file.

Could you please trigger it to auto-attach R session just like "R: Run Current Chunk, Control+Shift+Enter"?

Of course, I have enabled the following option in .Rprofile:

options(vsc.rstudioapi = TRUE)
MilesMcBain commented 3 years ago

Unfortunately this is hard to do because as part of the R session being attached a list of available addins in the user's library is scraped and written out to a file to be read by the VSCode extension later when you run the addin picker.

So that menu can't exist before at least one R session has been created.

It would be possible to rejig things so that the menu initiated the scraping on demand the first time it is run, but that would make the menu kind of slow and unresponsive that first time you run it, which I think is not great. Then there's also the issue of when to refresh the menu items.

You can create a keybinding to run an addin of your choosing in the way you desire. Perhaps that is enough?

jooyoungseo commented 3 years ago

Aw, thanks for your detailed explanation @MilesMcBain! Understood.

Please feel free to close this issue at your best convenience :)