1
1
---
2
- title : " Visual Studio Code"
2
+ title : " Visual Studio Code (VS Code) "
3
3
output :
4
4
html_document :
5
5
code_folding : show
@@ -13,10 +13,11 @@ knitr::opts_chunk$set(
13
13
class.source = "fold-show")
14
14
```
15
15
16
- # Tips and Tricks
16
+ # Tips and Tricks {#tipsAndTricks}
17
17
18
18
1 . You can view the source code side-by-side with the Preview (after selecting the code type in the bottom right):
19
19
![ Visual Studio Code] ( images/vsCode.png )
20
+ 1 . To create personalized CSS commands in VS Code, see [ here] ( https://devpsylab.github.io/DataAnalysis/markdown.html#css ) .
20
21
1 . To wrap code around the selected text (https://stackoverflow.com/a/73344832/2029527 ; archived at https://perma.cc/P5JA-7DBC ):
21
22
1 . Press ` Ctrl ` +` Shift ` +` p `
22
23
1 . Type and select "Open Keyboard Shortcuts (JSON)"
@@ -36,9 +37,9 @@ knitr::opts_chunk$set(
36
37
1. Save the `keybindings.json` file.
37
38
1. Select the text you want to wrap, and press `Alt`+`Shift`+`e`
38
39
39
- # Example Code Snippets
40
+ # Example Code Snippets {#exampleCodeSnippets}
40
41
41
- ## Template
42
+ ## Template {#template}
42
43
43
44
```
44
45
[
@@ -53,7 +54,7 @@ knitr::opts_chunk$set(
53
54
]
54
55
```
55
56
56
- ## ` \begin{equation}...\end{equation} `
57
+ ## ` \begin{equation}...\end{equation} ` {#equation}
57
58
58
59
```
59
60
[
@@ -68,12 +69,32 @@ knitr::opts_chunk$set(
68
69
]
69
70
```
70
71
71
- # Connect to ` R `
72
+ # Connect to ` R ` {#connectToR}
73
+
74
+ 1 . Install ` R ` using the initial setup instructions described here: https://devpsylab.github.io/DataAnalysis/R.html#setup
75
+ 1 . Install the [ ` R ` extension] ( https://marketplace.visualstudio.com/items?itemName=REditorSupport.r ) for ` VSCode `
76
+ 1 . Go into the ` R ` extension settings
77
+ 1 . Set the ` rpath ` variable to be blank
78
+ 1 . Set the ` rterm ` variables (e.g., ` r.rterm.windows ` ) to be blank
79
+ 1 . Close VS Code
80
+ 1 . Set VS Code to Run as Administrator by default
81
+ 1 . Open VS Code as Administrator
82
+ 1 . Launch the R terminal (Ctrl+Shift+P → "R: Create R terminal").
83
+
84
+ VS Code extensions to install:
85
+ - [ Quarto] ( https://marketplace.visualstudio.com/items?itemName=quarto.quarto )
86
+
87
+ ` R ` packages to install:
88
+ - ` install.packages(c("languageserver","httpgd")) `
89
+ - ` languageserver ` is used for syntax highlighting and code completion
90
+ - ` httpgd ` is used for plotting in VS Code
91
+
92
+ ## Old Instructions {#oldInstructions}
72
93
73
94
Follow the instructions here to connect ` VSCode ` to ` R ` :
74
95
https://stackoverflow.com/a/66069540/2029527 (archived at https://perma.cc/FCF5-26BT )
75
96
76
- 1 . Install ` R ` using the inital setup instructions described here: https://devpsylab.github.io/DataAnalysis/R.html#setup
97
+ 1 . Install ` R ` using the initial setup instructions described here: https://devpsylab.github.io/DataAnalysis/R.html#setup
77
98
1 . Install the ` R ` extension for ` VSCode `
78
99
1 . Go into the ` R ` extension settings
79
100
1 . Set the ` R ` path to the path of your ` R ` installation:
0 commit comments