Skip to content

Unexpected Closing Parentheses and Braces When Executing Code Chunks in R #1390

Closed as not planned

Description

@brianmsm

Describe the bug
When executing certain chunks of R code using VSCode with the R extension and Radian, I sometimes observe additional closing parentheses or braces being sent to the console, which were not present in the original code. This issue seems to occur after a small delay.

To Reproduce
This issue occurs sporadically and I have been unable to identify a consistent pattern. However, I've noticed that it happens frequently when I run the following chunks of R code multiple times:

data_test <- reduce(rep(list(mtcars), 2), bind_rows)

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

No

(If applicable) Please attach setting.json

{
    "[r]": {
        "editor.defaultFormatter": "REditorSupport.r",
        "editor.formatOnSave": false,
        "editor.wordSeparators": "`~!@#%$^&*()-=+[{]}\\|;:'\",<>/?"
    },
    "[rmd]": {
        "editor.defaultFormatter": "REditorSupport.r",
        "editor.formatOnSave": false
    },
    "r.rmarkdown.knit.openOutputFile": true,
    "r.rmarkdown.codeLensCommands": [
        "r.runCurrentChunk",
        "r.runAboveChunks",
        "r.runBelowChunks"
    ],
    "r.source.encoding": "UTF-8",
    "r.source.focus": "editor",
    "r.alwaysUseActiveTerminal": false,
    "r.sessionWatcher": true,
    "r.rtermSendDelay": 8,
    "r.plot.useHttpgd": true,
    "r.lsp.debug": true,
    "r.rterm.windows": "C:\\Users\\brian\\AppData\\Local\\Programs\\Python\\Python311\\Scripts\\radian.exe",
    "r.liveShare.defaults.commandForward": true,
    "r.rterm.linux": "/usr/bin/radian",
    "r.liveShare.defaults.shareBrowser": true,
    "r.bracketedPaste": true,
    "r.session.levelOfObjectDetail": "Normal"
}

Expected behavior
I expect the code to be sent to the console as it is, without any additional characters.

Screenshots
Animation

Environment (please complete the following information):

  • OS: Windows 11
  • R Version: 4.3.0
  • VSCode Version: 1.79.2
  • Radian Version: 0.6.4

Additional context
I noticed that when I format the code differently, the problem does not occur. For instance, the following code does not produce the issue:

data_test <- reduce(
  rep(list(mtcars), 2),
  bind_rows
)

In addition, it also does not play when instead of using bind_rows, I use rbind :

data_test <- reduce(rep(list(mtcars), 2), rbind)

Activity

  1. LR1933 commented on Jul 7, 2023

    @LR1933

    I have been aware of this issue for the past two years and have been searching for a solution, as having this problem renders Radian completely unusable. However, I have been unable to find a solution thus far.

    Based on the results of my attempts, I have found that this problem is prone to occur when executing lines of code that contain numerous parentheses(for reference only).

    I made an example, a formula I scribbled. When I run it slowly, there are no errors. However, when I run it continuously, unexpected brackets appear.

    2023-07-07.174752.mp4

    When I run a shortened version of the formula, even with a quick click, it runs without errors.

    2023-07-07.175159.mp4

    Similar error donot occur in R terminal (not radian).

    2023-07-07.180113.mp4
  2. brianmsm commented on Jul 16, 2023

    @brianmsm
    Author

    Well, this seems to be an old and already known problem: #419, #820, randy3k/radian#303, randy3k/radian#277, randy3k/radian#230 . And it is only happening on windows, because Bracketed paste mode is not supported.

    The first one associated with the addition of parentheses or braces when sending a code to the console. It seems as if there is a brief desynchronization when sending the code to the console, and radian tries to close parenthesis before seeing that it was already closed. This can be easily fixed by disabling auto-completion in the .Rprofile or .radian_profile file.

    options(radian.auto_match = FALSE)
    1. The second is a bit more problematic and is apparently occurring when the code block is very large, or when a chunk is executed that has several code blocks and these have to be sent all at once to the console. There is a very temporary workaround proposed here that reduces the number of times the problem occurs, although it still happens: Send code to terminal by Ctrl + ENTER but don't run #820 (comment)
  3. LR1933 commented on Jul 19, 2023

    @LR1933

    I remembered that someone told me this before, but I don't know where ".radian_profile" is. Can you tell me how to find ".radian_profile", thanks.

  4. D3SL commented on Jul 20, 2023

    @D3SL

    @brianmsm There's also, in my experience at least, two new showstopping bugs that started recently: Radian eventually stops printing any output at all, and prior to that it will begin freezing for tens of seconds or more at a time in the middle of executing even a single line of code.

    What's interesting to me is all of these feel like regressions. When I first began using VSCode-R with Radian the only issue I had consistently was the buildup of background processes from the language server, and only something as huge as an entire shiny app would fail to auto-execute on ctrl+enter. Both VSCode-R and Radian have steadily gotten less reliable and performant with time.

    For example starting an R session with the built in command palette function on an SSH remote is unusable, but calling R at the terminal to create an R session works great.

  5. benz0li commented on Jul 21, 2023

    @benz0li
    Contributor

    There's also, in my experience at least, two new showstopping bugs that started recently: Radian eventually stops printing any output at all, and prior to that it will begin freezing for tens of seconds or more at a time in the middle of executing even a single line of code.

    @D3SL Can you reproduce this on my reference deployment at https://demo.jupyter.b-data.ch?

    • OS: Debian 12
    • Code Version: 1.79.2
    • Radian Version: 0.6.6
      • r executable: /usr/local/lib/R/bin/R
      • r version: 4.3.1
      • python executable: /usr/local/bin/python
      • python version: 3.11.4

    ℹ️ These seem to be Windows specific issues.

  6. nicholskl commented on Jul 28, 2023

    @nicholskl

    New to VSCode-R, and love the idea of it more than the experience at this point. These bugs - persisting even after trying solutions - make Radian completely unusable. Hard to believe these problems have persisted for years apparently.

  7. thedbcooper commented on Feb 20, 2024

    @thedbcooper

    I am still having this issue using Windows 10. Radian is not usable in its current state for me.

  8. nicholskl commented on Feb 21, 2024

    @nicholskl

    Unbelievable that this hasn't been fixed or addressed.

  9. D3SL commented on Feb 21, 2024

    @D3SL

    @nicholskl that's a bit over the line. First this is fundamentally a problem with Windows itself, and second VSCode-R is basically a two-man show run by Renkun-ken and Ikuyadeu. And they're fighting an uphill battle against the RStudio monopoly.

  10. micdonato commented on Jun 26, 2025

    @micdonato

    I have this issue on Mac OS, setting auto_match to FALSE in .radian_profile works (but somehow putting it in .Rprofile doesn't)

  11. eitsupi commented on Sep 22, 2026

    @eitsupi
    Member

    Does this problem still occur if I use arf console instead of radian?
    https://github.com/eitsupi/arf

  12. ThomasSoeiro commented on Sep 26, 2026

    @ThomasSoeiro
    Collaborator

    @eitsupi @Fred-Wu @grantmcdermott I think we should close this issue as obsolete (like we did for #1090)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions