Vscode-r: Tilde character not passed to terminal

Created on 17 Nov 2019  Â·  14Comments  Â·  Source: Ikuyadeu/vscode-R

  • VSCode Version: 1.40.1
  • VSCode-R Version: 1.1.8
  • OS Version: Windows 10

using function lm I noticed that the tilde character, "~", is not passed to the terminal. Note that I have configured the italian keyboard

All 14 comments

Hi @arcalb, thanks for using vscode-R! Could you provide a short example that says:

  1. The code you are sending to the terminal
  2. The command you are using to send the code
  3. The text that appears in the terminal

Also, have you enabled the setting r.bracketedPaste?

Thank you!

1) I try to send to the terminal the code

lm(1:3 ~ 1:3)

2) I select the row and I send the code with ctrl+enter

3) and the text that appears in the terminal is

lm(1:3 1:3)
Errore: unexpected numeric constant in "lm(1:3 1"

and yes I tried in the both cases with disabled and enabled the option
r.bracketedPaste

Il giorno lun 18 nov 2019 alle ore 00:33 Andrew Craig <
[email protected]> ha scritto:

Hi @arcalb https://github.com/arcalb, thanks for using vscode-R! Could
you provide a short example that says:

  1. The code you are sending to the terminal
  2. The command you are using to send the code
  3. The text that appears in the terminal

Also, have you enabled the setting r.bracketedPaste?

Thank you!

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Ikuyadeu/vscode-R/issues/145?email_source=notifications&email_token=ABT5DUW6WWMK7HCDG2SFIATQUHIFHA5CNFSM4JOLFRD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEIZMYA#issuecomment-554800736,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABT5DUSB3TXFMD374XRIY7TQUHIFHANCNFSM4JOLFRDQ
.

Great, thank you for providing that information. Let’s try to figure out where the problem is occurring. Could you try the following and let me know the results?

  1. Instead of sending the code with Ctrl-Enter, send the code using the command Terminal: Run Selected Text in Active Terminal

  2. Create a non-R terminal (the default Windows terminal), and send the following code using Terminal: Run Selected Text in Active Terminal:

rem lm(1:3 ~ 1:3)

Thank you!

Please note I edited to add rem in front of the code, as I think lm is a Windows command.

1) the tilde symbol is passed to the internal terminal (without executing R)
2) even if I created the external terminal through the command "open new external terminal" the command "Run Selected Text in Active Terminal" created an internal terminal and run the code in it

Thank you for trying those and letting me know the results.

To summarise:

  • Sending code to the R console with Ctrl-Enter does NOT send the tilde
  • Sending code to the R console with Terminal: Run Selected Text in Active Terminal DOES send the tilde

If I've got that wrong, please let me know.

If that's correct, it sounds like it might be a bug somewhere in the vscode-R code that chooses and sends the code. I'll have a look and see if I can see where it might be happening.

I've also tried a copy and paste in the terminal. It works outside R, it
doesn't work if I run R in the terminal. Therefore I think it can be also
due to the keys and text coding in Rterm.exe executed in the vscode
terminal. Consider that, for instance, also the arrows key don't work
inside R but work in the terminal outside R.

Il mar 19 nov 2019, 12:22 Andrew Craig notifications@github.com ha
scritto:

Thank you for trying those and letting me know the results.

To summarise:

  • Sending code to the R console with Ctrl-Enter does NOT send the tilde
  • Sending code to the R console with Terminal: Run Selected Text in
    Active Terminal DOES send the tilde

If I've got that wrong, please let me know.

If that's correct, it sounds like it might be a bug somewhere in the
vscode-R code that chooses and sends the code. I'll have a look and see if
I can see where it might be happening.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Ikuyadeu/vscode-R/issues/145?email_source=notifications&email_token=ABT5DUXKU4IA6BT33NZOI53QUPEARA5CNFSM4JOLFRD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEN3GWA#issuecomment-555463512,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABT5DUUDDMASERDLGIRUFODQUPEARANCNFSM4JOLFRDQ
.

Thanks for the update! I’ll be pleased if it’s not a vscode-R bug.

As a workaround, perhaps try the radian console instead of the standard R console?
https://github.com/randy3k/radian
It’s an alternative R console that feels much more modern and generally has more keyboard support. It might handle pasting the tilde properly.

If you have any more updates let us know!

I've installed radian, throug python 3.7.5 (because with the version 3.8.0,
pip returned an error). Now the arrows-key work but again the tilde symbol
is not passed. Therefore it is not the R console.

Il giorno mar 19 nov 2019 alle ore 14:21 Andrew Craig <
[email protected]> ha scritto:

Thanks for the update! I’ll be pleased if it’s not a vscode-R bug.

As a workaround, perhaps try the radian console instead of the standard R
console?
https://github.com/randy3k/radian
It’s an alternative R console that feels much more modern and generally
has more keyboard support. It might handle pasting the tilde properly.

If you have any more updates let us know!

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Ikuyadeu/vscode-R/issues/145?email_source=notifications&email_token=ABT5DUVAO7IIR7PLAGXDBIDQUPR7JA5CNFSM4JOLFRD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEOFJBI#issuecomment-555504773,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABT5DUSHXNL2CQ4VYIZQKWLQUPR7JANCNFSM4JOLFRDQ
.

Thanks for trying radian, sorry to hear it didn’t help either.

I've also tried a copy and paste in the terminal. It works outside R, it
doesn't work if I run R in the terminal.

To confirm:

  • When you paste a tilde into a non-R terminal in VSCode, it works
  • When you paste a tilde into an R terminal in VSCode, it doesn’t work

Can you try these?

  1. Paste a tilde into an R terminal NOT in VSCode
  2. Paste a tilde into a Python terminal in VSCode
  1. it doesn't work, both in cmd and powershell
  2. it works both in cmd and powershell

Il giorno mar 19 nov 2019 alle ore 23:50 Andrew Craig <
[email protected]> ha scritto:

Thanks for trying radian, sorry to hear it didn’t help either.

I've also tried a copy and paste in the terminal. It works outside R, it
doesn't work if I run R in the terminal.

To confirm:

  • When you paste a tilde into a non-R terminal in VSCode, it works
  • When you paste a tilde into an R terminal in VSCode, it doesn’t work

Can you try these?

  1. Paste a tilde into an R terminal NOT in VSCode
  2. Paste a tilde into a Python terminal in VSCode

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Ikuyadeu/vscode-R/issues/145?email_source=notifications&email_token=ABT5DUVI7WWPZD3K2KRH4YDQURUSFA5CNFSM4JOLFRD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEQB2RY#issuecomment-555752775,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABT5DUTLJY35CT77BTXNTK3QURUSFANCNFSM4JOLFRDQ
.

Thank you for trying all these variations!

If pasting an tilde into an R terminal outside of VSCode doesn’t work, then it sounds like this might be an R problem rather than a vscode-R problem.

The only vscode-R approach I can think of is to modify the runTextInTerm function so that it detects tilde characters and replaces them with something like this. I’m not sure if that would work though! Also, I wouldn’t be able to test this so you would probably have to make this change yourself. If you do want to try this, I am happy to provide assistance where I can.

@arcalb I think we've identified this as an R problem rather than a vscode-R problem, so I'm going to close this issue. But if you disagree please post, and we can continue looking into it.

From https://github.com/Ikuyadeu/vscode-R/issues/307#issuecomment-623518415

PS: previously I noticed another issue in Windows with the Italian keyboard (#145) that it was due to Rterm.exe, therefore, I reported it to the R developers (https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17679) now solved in R version 4.0.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

michaelHL picture michaelHL  Â·  4Comments

maxheld83 picture maxheld83  Â·  4Comments

andycraig picture andycraig  Â·  4Comments

albert-ying picture albert-ying  Â·  5Comments

michaelHL picture michaelHL  Â·  5Comments