REditorSupport / vscode-R

R Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=REditorSupport.r
MIT License
1.07k stars 128 forks source link

"Terminal: clear" does not work with vscode-R #307

Closed albertoarcagni closed 4 years ago

albertoarcagni commented 4 years ago

VSCode Version: March 2020 (version 1.44) VSCode-R Version: 1.3.0 OS Version: Windows 10 1909 (italian)

Create an R file and run R in vscode Run the vscode command "Terminal: clear" and observe that the terminal clears Run the source or a line the R code is executed but the cleared code reappears

renkun-ken commented 4 years ago

I cannot reproduce what you observe. Would you like to elaborate or provide some screenshots?

albertoarcagni commented 4 years ago

image run R in the terminal image write some code in the terminal, for instance print a dataframe image image clear the terminal (ctrl+shift+p and write the command terminal: clear) image now run the code from the script (in this example I run the source with ctrl+shift+s but there is the same problem if you run only one line or the selection) image the cleaned code in the terminal reappears

renkun-ken commented 4 years ago

vscode-R does nothing about terminal context storage. I guess it is an issue of VSCode terminal under Windows. @andycraig any idea on this?

albertoarcagni commented 4 years ago

I'm sorry,

I confirm that it is a vscode problem: after your reply, I tested with python and there is the same problem and I found many bug-reports not solved and closed about it, for instance: https://github.com/microsoft/vscode/issues/81299

I also observed that the R function shell("cls") solves the problem in windows (and maybe some other arguments are necessary for other OS).

Therefore, before closing this issue I would like to ask you if you can integrate a shortcut to run it.

Best Alberto

PS: previously I noticed another issue in Windows with the Italian keyboard (https://github.com/Ikuyadeu/vscode-R/issues/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. I really desire an RStudio alternative!

renkun-ken commented 4 years ago

You may take a look at https://github.com/Ikuyadeu/vscode-R/wiki/Keyboard-shortcuts#creating-keybindings-for-r-commands and create your own command shortcut keys by yourself.

albertoarcagni commented 4 years ago

thank you

PS: I added this shortcut in keybindings.json { "description": "clear R console in Windows", "key": "ctrl+alt+l", "command": "r.runCommand", "args": "shell('cls')" }

andycraig commented 4 years ago

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.

@arcalb Thank you for this update! Good on you for reporting it to the R team and I'm pleased to hear it was resolved. I'll copy this over to the original issue too.