Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS code mangles command when sending selection to R

When I open a .R file and highlight a line and press Shift + Enter, VS code sends the line to R, but it mangles the text. For example, if I try to run

library(data.table)

Here is what I get back from R:

> 00~library(data.table)01~
Error: unexpected numeric constant in "00~library(data.table)01"

Strangest thing. VS Code works fine for me for Go, Typescript, Haskell, Python, but it doesn't like R. Any suggestions?

like image 628
Roger J Bos CFA Avatar asked Aug 31 '25 18:08

Roger J Bos CFA


1 Answers

It looks like bracketed paste mode is on. Try adding this to your settings.json:

"r.bracketedPaste": false

Bracketed paste mode should usually be on if using the radian console but off if using the standard R console.

like image 147
andycraig Avatar answered Sep 02 '25 07:09

andycraig