Skip to content

shim the rstudioapi if it has already been loaded#610

Merged
renkun-ken merged 2 commits intoREditorSupport:masterfrom
MilesMcBain:master
Apr 7, 2021
Merged

shim the rstudioapi if it has already been loaded#610
renkun-ken merged 2 commits intoREditorSupport:masterfrom
MilesMcBain:master

Conversation

@MilesMcBain
Copy link
Copy Markdown
Collaborator

fixes bug reported in #605

What problem did you solve?

If the user has something in their .Rprofile that refers to the rstudioapi namespace, then that causes the namespace to be loaded before we can attach our onLoad hook in the extension R session initialisation routine.

RStudio Addins can be browsed via the picker, but not run in this case.

(If you do not have screenshot) How can I check this pull request?

If you want to verify the bug you can add rstudioapi::is_available() to your alongside vsc.rstudioapi = TRUE in your .Rprofile and then try to run

rstudioapi::insert_text("test")

You should see: Error: RStudio not running

With this PR in place, try the same sequence and the text will be inserted into the current text editor window.

Copy link
Copy Markdown
Member

@renkun-ken renkun-ken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Works as expected. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants