radian icon indicating copy to clipboard operation
radian copied to clipboard

Awalys has a "`)`" when submit a function to terminal

Open Fred-Wu opened this issue 2 years ago • 8 comments

When I submit some codes to terminal, it always ends up with a ) in the terminal. Re-submit won't see it.

Something like this.

toy_fun <- function() {

}
)

Fred-Wu avatar Aug 12 '21 06:08 Fred-Wu

What OS is it and how do you submit the code to the terminal? Copy and paste?

randy3k avatar Aug 12 '21 06:08 randy3k

Running Vscode 1.59.0 on Windows 10.

I usually submit the code with Ctrl + Enter in the beginning or the end of a function.

Just happened again for a for loop

    for (i in seq(length(dlist))) {
      data <- dlist[[i]]
      predvar <- quantile(data$tmean, 1:99 / 100, na.rm = T) 

      argvar <- list(
        x = predvar, fun = varfun,
        knots = quantile(data$tmean, varper / 100, na.rm = T), degree = vardegree,
        Bound = range(data$tmean, na.rm = T)
      )
      bvar <- do.call(onebasis, argvar)
      minperccity[i] <- (1:99)[which.min((bvar %*% blup[[i]]$blup))]
      mintempcity[i] <- quantile(data$tmean, minperccity[i] / 100, na.rm = T)
    }
    )    # here ")" appear again

Fred-Wu avatar Aug 12 '21 07:08 Fred-Wu

It is a known issue on VSCode on windows because Microsoft terminal doesn't support brackted paste mode. I believe there are some relevant threads on vscode-R.

Until, it is addressed upstream, a temporary workaround is to set options(radian.auto_match = FALSE)

randy3k avatar Aug 12 '21 08:08 randy3k

Putting this here because it could be related (Windows 10, VS Code 1.59.0): the radian terminal often has a trailing " and fails to distinguish separate lines. E.g., I run each line of the script separately, but the after the second URL is defined radian just starts concatenating commands (i.e. the lack of r$> in the radian terminal).

Setting options(radian.auto_match = FALSE) does fix this issue.

image

baslat avatar Aug 14 '21 21:08 baslat

see also #277 and #230

assignUser avatar Sep 05 '21 08:09 assignUser

Hi, @randy3k , is it possible to turn off auto_match when we sending code to radian terminal but just turn on it when we typing code directly in radian manually?

Yunuuuu avatar Oct 12 '21 06:10 Yunuuuu

Hi, @randy3k , is it possible to turn off auto_match when we sending code to radian terminal but just turn on it when we typing code directly in radian manually?

Are you on Windows? Bracket paste mode should be enabled on Mac and Linux.

randy3k avatar Oct 12 '21 06:10 randy3k

Thanks for your help

Yes, I'll turn off it and check off this.

Yunuuuu avatar Oct 12 '21 07:10 Yunuuuu