vscode-R icon indicating copy to clipboard operation
vscode-R copied to clipboard

Multiline strings are not send to console in one block

Open ThomasSoeiro opened this issue 2 months ago • 1 comments

Describe the bug

Multiline strings are not send to console in one block.

To Reproduce

x <- "foo
bar"

y <- "
foo
"

z <- '
bar
'

Can you fix this issue by yourself? (We appreciate the help)

No

Expected behavior

Multiline strings should be sent to console in one block.

Environment (please complete the following information):

  • OS: Windows 11
  • VSCode Version: VSCodium 1.106.37943
  • R Version: 4.4.0
  • vscode-R version: 2.8.6

ThomasSoeiro avatar Dec 10 '25 14:12 ThomasSoeiro

I confirm the issue also exists with lastest upstream VSCode:

Version: 1.107.0 Commit: 618725e67565b290ba4da6fe2d29f8fa1d4e3622 Date: 2025-12-10T07:43:47.883Z Electron: 39.2.3 ElectronBuildId: 12895514 Chromium: 142.0.7444.175 Node.js: 22.21.1 V8: 14.2.231.21-electron.0 OS: Windows_NT x64 10.0.22631

ThomasSoeiro avatar Dec 11 '25 15:12 ThomasSoeiro

Possibly related to https://github.com/REditorSupport/vscode-R/issues/173

ThomasSoeiro avatar Dec 12 '25 09:12 ThomasSoeiro

You could wrap it using R's raw string literal r"(text)"

x <- r"(foo bar)"

z <- r"(
bar
)"

Fred-Wu avatar Dec 17 '25 13:12 Fred-Wu

Thanks.

However, that really seems like a bug to me. We shouldn't need a workaround to send multiline strings to the console. This is not needed e.g. in RStudio or Positron.

BTW, another simpler workaround is enclosing the string in braces.

ThomasSoeiro avatar Dec 17 '25 14:12 ThomasSoeiro