

This solved a problem I was running into on my Mac, so I enabled it. This means all R code will be sent to the current, active terminal-even if it’s not an R terminal-instead of launching a new R terminal.

The other setting I turned on was R: Always Use ActiveTerminal. The vscode-R extension’s documentation mentioned a couple of other settings to update. You should see a choice to open the graphical UI or the underlying JSON file. Once you’ve opened the command palette, you can use it to get to VS Code settings by typing Open Settings. You can use the command palette to access VS Code settings options. In VS Code, you can pull up the command palette either with the F1 key or the key combination Control-Shift-P on Windows or Command-Shift-P on Mac. A lot of software development environments have command palettes, and they’re good to get to know. The command palette is a handy way of accessing all sorts of VS Code capabilities by typing instead of pointing and clicking at menus.

You can also get to the settings UI using Visual Studio Code’s command palette. You can then search for “bracketedPaste” and click to enable it. (The other option is editing the underlying settings JSON file.) To get to the settings UI, go to either File > Preferences > Settings on Windows or Code > Preferences > Settings on Mac. The easiest way to change a VS Code setting is to open up the settings user interface. That means I need to go into VS Code settings and turn that setting on if it’s not already enabled. The vscode-R extension instructions also said I needed to “enable config r.bracketedPaste”. If you don’t, both jsonlite and rlang can be installed from CRAN with install.packages(). I already have those on my system, but you’ll want to make sure you do, too. The vscode-R extension’s wiki also recommends installing two other R packages, by the way: jsonlite and rlang. To install vscode-r-lsp, I can either go back to my Visual Studio Code window and install it from the VS Code extensions marketplace or I can click the install button on the vscode-r-lsp web page. Languageserver is a regular R package, so I can go back to RStudio or an R terminal and install it the usual way, with install.packages("languageserver"). (Update: vscode-r-lsp capabilities have now been integrated into the vscode-R extension, so you no longer need to install it separately.) There are a couple of other recommended installations for the vscode-R extension: languageserver and vscode-r-lsp.
