Skip to content

Send to terminal doubles closing parentheses  #419

Closed

Description

@assignUser

Sometimes when I send lines or blocks to the console via ctrl+enter without selecting the code, the ending parentheses will be doubled and stop the code from being run:
image
If the line/block of code is selected this never happens.
I have not managed to reproduce the bug reliably :(
It happens often enough when executing expect_*() within test_that blocks that I assume it it has something todo with the enclosing brackets. It also only happens on the last statement in a block but does also happen when it is the only one:

test_that("assertInRange works", {
  expect_silent(assertInRange(a = 1:5, range = c(0, 100)))
})

I have tried to reproduce the bug with similarly nested, more generic functions (also "non-function" with same arguments) but could not get the bug to show up.

Activity

  1. andycraig commented on Oct 10, 2020

    @andycraig
    Collaborator

    Hi @assignUser, thank you for reporting this. This is a weird one.

    When this problem happens, if you immediately try to send the same line/block again, does the extra parenthesis appear again?

    It looks like you are using radian. I think radian does some autocompletion of parenthesis etc. as well, so it is possible that this is some interaction problem between vscode-R and radian. (Although the fact that the error doesn't occur if you select the code does suggest that this is just due to vscode-R.) Next time this happens, could you try opening a plain R terminal, send the line/block to that, and see whether the extra parenthesis appears?

    Extra examples might be useful too. The next few times this happens, if you could paste here the code section from the editor, the code that appears in the console, and indicate where the cursor was when you hit Ctrl-Enter, that would be great.

  2. assignUser commented on Oct 10, 2020

    @assignUser
    ContributorAuthor

    I will swicht to plain r-term and try to reproduce the error.

  3. assignUser commented on Oct 10, 2020

    @assignUser
    ContributorAuthor

    Can not reproduce at all with R.exe so it must be an issue with radian. I will look into it and open an issue there.

  4. andycraig commented on Oct 10, 2020

    @andycraig
    Collaborator

    @assignUser Thank you for investigating!

    Since it only seems to occur with radian, I thought of something else. Do you have r.bracketedPaste enabled? If not, try enabling that and see if the problem persists.

  5. assignUser commented on Oct 10, 2020

    @assignUser
    ContributorAuthor

    I have brackted paste activated. Interestingly, when I turn it off the error now happens more often... so very likely that it is an issue with radians input checks

  6. YandLiu commented on Oct 17, 2020

    @YandLiu

    I also had this problem so I turned off radian.auto.match, just add following code to the radian profile: options(radian.auto_match = FALSE)
    But apparently this is only a temporary solution, waiting for someone to open an issue there.

  7. flo-schu commented on Feb 11, 2021

    @flo-schu

    I'm having the same issue. For me this happens particularly often when I have a double quote symbol followed by a closing parenthesis.

    ")

    Then the the line appears in the terminal

    c("example", "example")
    ")
    

    The cursor then is at the beginning of the second line.

    I can actually reproduce this error even when the whole line is highlighted. Executing the code repeatedly very fast works some time, but after executing the same line over and over again, at one point the error happens.

    More than 50 characters in the execution statement seem to be a problem

  8. humanfactors commented on Oct 8, 2021

    @humanfactors

    Has anyone found a solution to this yet? Starting to drive me bonkers. The ") is exactly for me as well.

  9. renkun-ken commented on Oct 8, 2021

    @renkun-ken
    Member

    Does it still occur with the latest version of radian being used and r.bracketedPaste enabled in vscode?

  10. Yunuuuu commented on Oct 11, 2021

    @Yunuuuu

    Still here windows with latest vscode-r and radian. It’s interim and I didn’t find a way to reproduce it firmly.

  11. Yunuuuu commented on Oct 11, 2021

    @Yunuuuu

    It incline to occur when I send larger code once at all to radian.

  12. Yunuuuu commented on Oct 11, 2021

    @Yunuuuu

    Radian repos has some similar issues like:
    first, Second , Third

  13. humanfactors commented on Oct 12, 2021

    @humanfactors

    The issue resolves with options(radian.auto_match = FALSE).

    However, yes the issue occurs under latest build of and radian version: 0.5.11 and ikuyadeu.r 2.3.1, with r.bracketedPaste enabled.

  14. randy3k commented on Oct 12, 2021

    @randy3k
    Member

    Does it still occur with the latest version of radian being used and r.bracketedPaste enabled in vscode?

    As far as I know, bracket paste mode is not supported by VSCode terminal on Windows.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions