1 Tips and Tricks

  1. You can view the source code side-by-side with the Preview (after selecting the code type in the bottom right): Visual Studio Code
  2. To wrap code around the selected text (https://stackoverflow.com/a/73344832/2029527; archived at https://perma.cc/P5JA-7DBC):
    1. Press Ctrl+Shift+p
    2. Type and select “Open Keyboard Shortcuts (JSON)”
    3. Add the following item:
    [
     {
         "key": "alt+shift+e",
         "command": "editor.action.insertSnippet",
         "when": "editorTextFocus",
         "args": {
             "snippet": "<TEXT-BEFORE>$TM_SELECTED_TEXT</TEXT-AFTER>"
         }
     }
    ]
    1. Save the keybindings.json file.
    2. Select the text you want to wrap, and press Alt+Shift+e

2 Example Code Snippets

2.1 Template

[
    {
        "key": "alt+shift+e",
        "command": "editor.action.insertSnippet",
        "when": "editorTextFocus",
        "args": {
            "snippet": "<TEXT-BEFORE>$TM_SELECTED_TEXT</TEXT-AFTER>"
        }
    }
]

2.2 \begin{equation}...\end{equation}

[
    {
        "key": "alt+shift+e",
        "command": "editor.action.insertSnippet",
        "when": "editorTextFocus",
        "args": {
            "snippet": "\\begin{equation}\n$TM_SELECTED_TEXT\n\\end{equation}"
        }
    }
]

3 Connect to R

Follow the instructions here to connect VSCode to R: https://stackoverflow.com/a/66069540/2029527 (archived at https://perma.cc/FCF5-26BT)

  1. Install R using the inital setup instructions described here: https://devpsylab.github.io/DataAnalysis/R.html#setup
  2. Install the R extension for VSCode
  3. Go into the R extension settings
  4. Set the R path to the path of your R installation:
    • e.g., C:\\R\\R-4.3.1\\bin\\x64\\R.exe
  5. Set the Rterm path to the path of your R installation
    • e.g., C:\\R\\R-4.3.1\\bin\\x64\\Rterm.exe
LS0tCnRpdGxlOiAiVmlzdWFsIFN0dWRpbyBDb2RlIgotLS0KCmBgYHtyIHNldHVwLCBpbmNsdWRlID0gRkFMU0V9CmtuaXRyOjpvcHRzX2NodW5rJHNldCgKICBlY2hvID0gVFJVRSwKICBlcnJvciA9IFRSVUUsCiAgY29tbWVudCA9ICIiLAogIGNsYXNzLnNvdXJjZSA9ICJ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