Skip to content

Refactor R code#602

Merged
ManuelHentschel merged 11 commits intoREditorSupport:masterfrom
ManuelHentschel:Rcode
Apr 2, 2021
Merged

Refactor R code#602
ManuelHentschel merged 11 commits intoREditorSupport:masterfrom
ManuelHentschel:Rcode

Conversation

@ManuelHentschel
Copy link
Copy Markdown
Member

@ManuelHentschel ManuelHentschel commented Apr 1, 2021

This PR contains some restructuring of the R code used in the extension. Changes are:

  • Move function definitions from init.R to their own file vsc.R. This hopefully makes it easier to contribute new functions etc. (in vsc.R) without having to worry about the technical issues solved in init.R.
  • Attach tools:vscode after loading default packages. This makes it possible to mask e.g. View without having to mess with the environment of the utils package itself.
  • Source R code directly from the installation directory of the extension. Since vscode is guaranteed to have access to its own files and the R process is launched by vscode, I don't think this should cause any read-access issues (please correct me if I'm wrong here)
  • Move temporary files (request.log, request.lock) to a temporary directory instead of the home directory.

The last two points imply that the directory ~/.vscode-R is not needed anymore.

Todo:

  • Check Rstudio api
  • Find solution for self-managed sessions (Maybe we should leave an optional "link file" in ~/.vscode-R? Or expose the path to init.R in the extension files somehow and let the user copy it to their .Rprofile?)

Comment thread src/session.ts Outdated
Comment thread src/session.ts
Comment thread R/init.R Outdated
@renkun-ken
Copy link
Copy Markdown
Member

I checked rstudioapi and it works now.

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

@ManuelHentschel ManuelHentschel merged commit a0c494c into REditorSupport:master Apr 2, 2021
@ManuelHentschel ManuelHentschel deleted the Rcode branch April 2, 2021 08:27
Comment thread R/init.R
Comment thread R/init.R
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