Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SendCode cannot send codes to RStudio when upgrading RStudio to version 2022.12.0 #170

Open
LiangCZhang opened this issue Dec 20, 2022 · 13 comments

Comments

@LiangCZhang
Copy link

LiangCZhang commented Dec 20, 2022

HI,
I am using sublime text 4126 on Windows 10. Sendcode was working fine and can send R codes to RStudio via ctrl+enter. However, when RStudio is upgraded to version 2022.12.0 Build 353, SendCode is not working anymore. Could you have a look at this? Thanks.

@rrodrigueznt
Copy link

I can confirm this behaviour on Windows 11.

@randy3k
Copy link
Owner

randy3k commented Dec 20, 2022

This is the python script that controls Rstudio
https://github.com/randy3k/SendCode/blob/master/code_sender/winauto.py

If someone wants to help, please follow the below steps and report what you see.

rid =  find_rstudio()
paste_to_rstudio(rid, from_view=False)  # this command should paste the current clipboard to Rstudio.

@rrodrigueznt
Copy link

Hi! On macOS 13.0.1 (22A400) now. RStudio 2022.12.0 Build 353. When in an R script, the first cmd+Enter launches RStudio, but no line will be sent afterwards.

It is the first time I have set up SendCode on Ventura. Thus I don't know if it is the new RStudio to blame or if I'm missing some step. Anyone can send an R code to Sublime working with macOS Venture?

I will try on my Windows 11 boxes early tomorrow (my time). I will also try on Ubuntu 20.04.

@rrodrigueznt
Copy link

From a Microsoft Windows 11 Pro Version 10.0.22621 Build 22621 running on a Dell XPS laptop:

PS C:\Users\ricar\OneDrive\Documents\Downloads> python
Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exec(open('./winauto.py').read())
>>> rid =  find_rstudio()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 168, in find_rstudio
Exception: window not found.
>>>

@rrodrigueznt
Copy link

Same result on a Windows 11 Pro 10.0.22621 Build 22621, same than above, running on a Dell OptiPlex 5080:

PS C:\Users\ricar\OneDrive\Documents\Downloads> python
Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exec(open('./winauto.py').read())
>>> rid =  find_rstudio()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 168, in find_rstudio
Exception: window not found.
>>>

@gc5011
Copy link

gc5011 commented Jan 3, 2023

I'm also having issues on OS X (I'm still on 10.15.7) with Rstudio (2022.12.0+353) when trying to use SendCode. This is the error message in the SublimeText console:

subprocess.CalledProcessError: Command '['osascript', '/Users/username/Library/Application Support/Sublime Text 3/Packages/SendCode/code_sender/rstudio/rstudio.applescript', 'library(tidyverse)\nlibrary(lubridate)\nlibrary(arsenal)\nlibrary(zscorer)']' returned non-zero exit status 1

In ScriptEditor, running tell application "RStudio" to cmd "print('hello')" returns an error: A """ can't go after this identifier". Is it possible that RStudio 2022.12.0+353 doesn't support applescript (or at least the syntax used in the sendcode rstudio.applescript)?

@gc5011
Copy link

gc5011 commented Jan 4, 2023

@rrodrigueznt on OS X rolling back to RStudio 2022.72+576 solved the issue for me and I can send code to RStudio from sublime text. I've raised an issue in the Rstudio repo

@randy3k
Copy link
Owner

randy3k commented Jan 4, 2023

RStudio has moved to electron rstudio/rstudio/wiki/Electron-Desktop.

On Mac, we use apple script to send code to RStudio and unfortunately electron doesn't support apple script.
On Windows, we use native Win32 api, I beleive we just need to figure out the new window class name.

@gc5011
Copy link

gc5011 commented Jan 4, 2023 via email

@phineas-pta
Copy link

how do you search for windows class name? i tried winlister, got "Chrome_WidgetWin_1", modified SUBLIME_PATH\Data\Packages\SendCode\code_sender\winauto.py but it doesn't work

@emilBeBri
Copy link

damn. A huge part of my workflow has just been destroyed. Guess it's time to move to neovim completely.

@fabeit
Copy link

fabeit commented Feb 27, 2023

Reporting the same issue. I don't like the Rstudio editor, I hope someone will help fix this. Any alternative to Sendcode?

@Sijianf
Copy link

Sijianf commented Oct 2, 2023

In the future, will there be updates for SendCode to make it support the latest RStudio? Thanks!
I am using a Macbook, and I have rolled back to the older version of RStudio. However, the plot function was disabled since R has updated its graphic engine. SendCode would stop sending codes once I called a plot() function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants