VS Code as R IDE



VS Code can be dressed up as an R IDE with the balance of form an function you would expect

VS Code as an R IDE.

vscode-R provides R session support from inside VS Code. In some locations this is referred to as Ikuyadeu.r? AFAICT they are the same but there is renaming in-progress. The home page for the integration is the vscode-R Wiki. Particularly interesting for me is the process of Interactive viewers and the support for rmarkdown.

There is deep integration of language internals (autocomplete etc) via R-languageserver client (which will eventually get merged into vscode-R apparently.) R needs the language server installed to make that go. Although, TBH I haven’t found use for it yet. My use of R is more to generate reports than to create packages, though, so perhaps I am not the target audience.

install.packages("languageserver")

The corresponding extension is

ext install REditorSupport.r-lsp

Debugger support is via vscDebugger:

install.packages(c('R6', 'jsonlite'))
# presumably also
install.packages('vscDebugger')

The following config in settings.json is helpful for keeping it fast with R development, since it ignores blogdown cruft and miscellaneous R packaging stuff.

  "files.watcherExclude": {
    "**/env/**": true,
    "**/output/**": true,
    "**/renv/**": true
  },
  "search.useGlobalIgnoreFiles": true,
  "files.exclude": {
    "content/**/*.html": true
  },
  "search.exclude": {
    "content/**/*.bib": true,
    "content/**/*.yaml": true
  },
  "cSpell.enableFiletypes": [
    "rmarkdown",
    "rmd"
  ],

For editing blogdown, an in-app browser preview can be useful, e.g. the (CPU-intensive) Browser Preview extension.


No comments yet. Why not leave one?

GitHub-flavored Markdown & a sane subset of HTML is supported.