radian icon indicating copy to clipboard operation
radian copied to clipboard

execute multiline selection in active [radian] terminal fails in vscode

Open mkarikom opened this issue 3 years ago • 10 comments

environment:

R 4.1.1 (linux) vscode 1.62.1 vscode settings:

// Use active terminal for all commands, rather than creating a new R terminal.
"r.alwaysUseActiveTerminal": false,

not working:

Selecting the following and hitting <ctrl+enter> tries to execute but fails with error:

library("pasilla")
pasCts <- system.file("extdata",
                      "pasilla_gene_counts.tsv",
                      package="pasilla", mustWork=TRUE)

output:

r$> dds <- DESeqDataSetFromMatrix(countData = cts,)
Error in h(simpleError(msg, call)) :
  error in evaluating the argument 'x' in selecting a method for function 'nrow': argument "colData" is missing, with no default

r$>                               colData = coldata,
Error: unexpected ',' in "                              colData = coldata,"

r$>                               design = ~ condition)
Error: unexpected ')' in "                              design = ~ condition)"

working:

after reformatting the statement as a single line, it succeeds (using same keystrokes as above):

pasCts <- system.file("extdata","pasilla_gene_counts.tsv",package="pasilla", mustWork=TRUE)
file.exists(pasCts)

output:

r$> file.exists(pasCts)                                                                                                                                                                                                                                                                                         
[1] TRUE

mkarikom avatar Nov 12 '21 16:11 mkarikom

It seems to be a vscode specific issue.

randy3k avatar Nov 12 '21 17:11 randy3k

Same here. Has this issue been solved? Thanks!

yanhao-wang avatar Apr 11 '22 16:04 yanhao-wang

Or does anybody know any turnaround?

yanhao-wang avatar Apr 11 '22 16:04 yanhao-wang

@yanhao-wang Try to enable "R: Bracketed Paste"-mode in settings.

mkhq avatar May 12 '22 14:05 mkhq

@yanhao-wang Try to enable "R: Bracketed Paste"-mode in settings.

This fixed it for me, thank you.

dereckmezquita avatar May 31 '22 23:05 dereckmezquita

Ok, just trying to drop more keywords in this issue thread so that I and others might find it faster next time: we were wondering whether this was due to CRLF or LF line endings on a WSL2/devcontainer setup running an Ubuntu as guest. We then set up a pure Ubuntu machine and the issue persisted with CR apparently being inserted after every line. We could not reproduce the issue on vanilla R, so it seems specific to radian.

I suggest this issue be closed 🙂

mmyrte avatar Oct 26 '22 09:10 mmyrte

Long story short, it is not due to the newline char. It is due to the fact that Microsoft terminal didn't support bracketed paste mode. PS: Not sure the current status.

randy3k avatar Oct 26 '22 17:10 randy3k

I'm having this same issue except with sublime text and sending code to terminus. It works fine when I use R without radian. Does anyone have any ideas how to solve this?

promicrobial avatar Sep 19 '23 21:09 promicrobial

I am having a similar issue only with going from RStudio to a terminal with Radian. Would love for there to be a solution for it. I really love using radian for all of its other features, but this becomes a workflow killer at times.

MichaelSchatz avatar Oct 05 '23 15:10 MichaelSchatz

I'm having this same issue except with sublime text and sending code to terminus. It works fine when I use R without radian. Does anyone have any ideas how to solve this?

Based on a comment by @mkhq above https://github.com/randy3k/radian/issues/320#issuecomment-1125059020, I was able to solve the issue in Sublime Text by changing the SendCode settings file (Preferences -> .Package Settings -> SendCode -> Settings)

In the default settings file:

"r" : {
        "prog": "tmux",
        // turn bracketed_paste_mode on if radian or readline 7.0 is in use
        "bracketed_paste_mode": false 
    }

Changed to:

"r":
	{
		"bracketed_paste_mode": true,
		"prog": "terminus",
	}

promicrobial avatar Jan 11 '24 19:01 promicrobial