This repo is meant to be used during a live demonstration of the VS Code IDE during a Schloss Lab Code Club. In it you will find setup instructions, and various file types that will help in this demo.
-
Please download VS Code from here. (If you are on a mac, make sure you drag VS Code to your applications folder after it downloads!)
-
If you'd like to practice using the Source Control with Github, make sure your Git credentials are updated on your local machine/Great Lakes!
-
If you'd like to use the snakemake portion of this lesson, please make sure to have snakemake installed. e.g. with miniconda3:
conda create -n snakemake snakemake
VS Code is a free IDE from microsoft that can be used with a variety of programming languages. It is completely customizable for exactly your needs. The use of extensions allow the user to add just the features they want. VS Code supports debugging, syntax highlighting, code completion, GitHub, keyboard shortcuts, and more! This repository mimics a typical Schloss Lab project directory to demonstrate the utility of VS Code for our everyday work.
To get the most out of VS Code, you'll want to install extensions for the languages and types of activities you'll be doing. Some useful extensions that we have identified are listed below:
- VSCode on Great Lakes:
- Snakemake
- Github Functions
- R specific
- Fun & convenient!
- Vscode-pdf - allows for viewing PDFs
- HTML Preview - allows for HTML previews
- Indent to Bracket - automatic indentation
- Rainbow csv - colored columns for csv/tsv files
- Path Intellisense - filename autocompletion
Additionally, to configure specific settings in VS Code you can either used the settings user interface or edith the settings.JSON file directly as described here
Walkthrough of the project directory
.
├── Makefile
├── README.md
├── code
│ ├── favorites_table.R
│ ├── make_plot.R
│ └── report.Rmd
├── data
│ ├── favorites.csv
├── envs
│ └── r-tidyverse.yaml
└── snakefile
Some extensions to get the most out of Github in VScode:
Git Issues and Pull Requests, Git Graphs, Git Lens
Follow-along steps to participate in this project
- Using the favorites.csv as a template, fill out a single line with your answers for the headers. Save-As your edits to a new file in the data folder with the pattern "favorites_{initials}.csv"
- We will
git commit
our new file using VScode Source Control! - we will
git push
our new files to the repo. There should be a unique file for everyone who is participating. - We will
git pull
all the new files into our repo.
Running through these steps should result in everyone having several favorites files in their data folder. Next we will use them in our data analysis.
Some extensions to get the most out of R/R Markdown in VScode:
- R
- R Markdown All in One
- Indent to Complete
R package to to install:
install.packages("languageserver")
Also recommended is installing the radian console for R.
Makefiles and Snakemake files have their own syntax highlighting and are easy to create, deploy and analyze output all from the same window with a variety of languages and functions.
To run all the steps of the example project with snakemake run the following code in the project home directory:
snakemake --cores all --use-conda
If you dont have snakemake configured, you can use the makefile instead. To run the makefile and produce all expected output files, execute this command from the top level of the project directory:
make all
You can remove all the output files by running:
make clean
A Fresh Start for R in VS Code