VSCode - neurogenomics/labwiki GitHub Wiki
VSCode is an IDE that support a ton of different languages (including R and Python). You can download it here.
Once it's installed, follow these steps.
First, if you're going to use R in VSCode there's several tools that make your life much easier.
This tutorial gives a really nice walkthrough of how to set up VSCode with R.
However, it's missing a few pieces of information.
So after going through the linked tutorial, read my notes below for clarification on those remaining points.
bash-3.2$ python3 -m pip install --user radian
sudo nano /etc/paths
(Add the following line to the /etc/paths file):
/Users/<username>/Library/Python/3.8/bin
Alternatively, you could install radian via conda.
You can also install radian into a specific conda env (as opposed to your whole OS).
Here's some very useful tips on how to use R successfully in conda envs.
bash-3.2$ conda create -n my_env r-essentials r-base
bash-3.2$ conda source my_env
bash-3.2$ pip install -U radian
bash-3.2$ which r
/usr/local/bin/r
bash-3.2$ which radian
/Users/schilder/Library/Python/3.8/bin/radian
In VSCode menu bar, go to File -> Preferences -> Settings, or simply use the key command: CMD,
I've indicated here where exactly you should enter which path.
{
"editor.renderControlCharacters": true,
"r.bracketedPaste": true,
//"r.rterm.windows": "/Users/schilder/Library/Python/3.8/bin/radian", //Use this only for Windows
//"r.rterm.linux": "/Users/schilder/Library/Python/3.8/bin/radian", //Use this only for Linux
"r.rterm.mac": "/Users/schilder/Library/Python/3.8/bin/radian", // Use this only for a Mac. ** RADIAN path goes here **
"r.lsp.path": "/usr/local/bin/r", // ** R path goes here **
"r.lsp.debug": true,
"r.lsp.diagnostics": true,
"r.rterm.option": [
"--no-save",
"--no-restore",
"--r-binary=/usr/local/bin/r" // ** R path goes here **
],
}
radian will automatically enable multiline coding when you use curly brackets, e.g.:
my_func <- function(x){
}
Install the Live Share Extension Pack here.
First, register your Live Share account via one of the options that it gives you in VSCode. GitHub is an easy option that just requires authorising 3rd party access with a single button push.
You can then connect to Live Share by clicking the "Live Share" button on the lefthand side of the bottom bar in VSCode.
If you have HPC mounted to your computer you can just open the project folder ( CMD+O
) and interact with it like you would any local project. The downsides are that it'll be slower to read/write files, and that you won't have access to the computing resources on HPC (to get around these two issues, I think we would have to request HPC to support VSCode).