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

Add a few more OpenRPC methods for rstudioapi shims #286

Merged
merged 3 commits into from
Apr 3, 2024

Conversation

juliasilge
Copy link
Contributor

@juliasilge juliasilge commented Apr 1, 2024

Addresses posit-dev/positron#1312 with what I hope 🤞 are the last Public Beta rstudioapi shims

Goes along with posit-dev/positron#2593

@juliasilge
Copy link
Contributor Author

To test this out, together with posit-dev/positron#2593, try:

rstudioapi::sendToConsole("1 + 1")
rstudioapi::sendToConsole("1 + 1", focus = FALSE)
rstudioapi::sendToConsole("1 + ")
rstudioapi::sendToConsole("lm(mpg ~ ., data = mtcars)")

some_code <- c("library(tidyverse)", "arrange(mtcars, mpg)")
rstudioapi::sendToConsole(some_code, focus = FALSE)
rstudioapi::documentNew(some_code)
rstudioapi::documentNew("SELECT * FROM 1", type = "sql")

language_id: String::from("r"),
code: RObject::view(code).try_into()?,
focus: RObject::view(focus).try_into()?,
allow_incomplete: false,
Copy link
Contributor Author

@juliasilge juliasilge Apr 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using false here to be consistent with the RStudio behavior for rstudioapi::sendToConsole("1 + ")

@juliasilge juliasilge marked this pull request as ready for review April 1, 2024 22:26
@juliasilge juliasilge requested a review from lionel- April 1, 2024 22:26
@juliasilge
Copy link
Contributor Author

juliasilge commented Apr 1, 2024

Addresses posit-dev/positron#2441 because I figured out what to do.

Short answer: the rstudioapi shims must have exactly the function signatures as from this file.

@juliasilge juliasilge requested a review from DavisVaughan April 3, 2024 03:15
crates/ark/src/ui/methods.rs Outdated Show resolved Hide resolved
@lionel- lionel- removed their request for review April 3, 2024 16:06
@juliasilge juliasilge merged commit 47d52d5 into main Apr 3, 2024
1 check passed
@juliasilge juliasilge deleted the last-rstudiapi-shims-i-hope branch April 3, 2024 16:32
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

Successfully merging this pull request may close these issues.

2 participants