randy3k / radian

A 21 century R console
MIT License
2k stars 76 forks source link

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

Open Fred-Wu opened 3 years ago

Fred-Wu commented 3 years ago

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() {

}
)
randy3k commented 3 years ago

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

Fred-Wu commented 3 years ago

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
randy3k commented 3 years ago

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)

baslat commented 3 years ago

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

assignUser commented 3 years ago

see also #277 and #230

Yunuuuu commented 2 years ago

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?

randy3k commented 2 years ago

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.

Yunuuuu commented 2 years ago

Thanks for your help

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