-
Notifications
You must be signed in to change notification settings - Fork 92
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
Feature Request: Shims for {rstudioapi} #1312
Comments
I would love to be able to run |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
We will have to keep in mind that some functions have a version guard through |
As per that search, only very old versions of RStudio -- from before the switch to calendar versioning -- are involved. Today getVersion() returns the calendar version.
I think we can just return the Positron version here; because Positron and RStudio both use calendar versioning, returning a calendar version that isn't Positron's version would be very confusing. Finally, I think most API behavior is gated through |
We're making progress on that front! We now have the infrastructure in place to implement rstudioapi shims and one POC method that lets |
Requests for
|
I'm also really interested in getting selection info/content re: making more reprex more featureful in Positron. Therefore, my current plan for "Jenny's first rstudioapi shim work" is to attempt that. |
Another high priority is finding a way to emulate/intercept |
Last week I added |
With the merge of #2132,
> x <- rstudioapi::getActiveDocumentContext()
> x
Document Context:
- id: ''
- path: 'Untitled-2'
- contents: <5 rows>
Document Selection:
- [1, 1] -- [1, 3]: '🤖🌷'
- [2, 1] -- [2, 3]: 'Ab'
- [3, 1] -- [3, 3]: '!😱'
- [4, 1] -- [4, 3]: '?💅'
> x$contents
[1] "🤖🌷" "Ab" "!😱" "?💅" ""
> x$selection[[1]]$text
[1] "🤖🌷" |
It's somewhat overoptimistic to say that we support both |
I note that Coming from: That suggests that these specific RStudio commands are a high priority. |
In posit-dev/ark#267 I included support for the |
I tend to think we are OK for Public Beta on supporting RStudio commands, and should wait on reports/feedback to add more: You can see what we have here: |
Lately I've also been wishing that |
I got |
There is a lot of work here and there are pretty detailed notes of what to try in the various PRs, but here would be a smorgasbord of testing: "hello 🌍, I like crème brûlée!"
"hello 🌷, I like crème brûlée!"
"hello 🤖, I like crème brûlée!"
"hello 🤷♀️, I like crème brûlée!"
"hello 😭, I like crème brûlée!"
"hello 💩, I like crème brûlée!"
"hello 🤷♀️, I like crème brûlée!"
"hello 🥔, I like crème brûlée!"
rstudioapi::setCursorPosition(rstudioapi::document_position(5, 1))
rgs <- list(
rstudioapi::document_range(rstudioapi::document_position(2, 3), rstudioapi::document_position(3, 1)),
rstudioapi::document_range(rstudioapi::document_position(4, 7), rstudioapi::document_position(4, 20)),
rstudioapi::document_range(rstudioapi::document_position(5, 7), rstudioapi::document_position(5, 20)),
rstudioapi::document_range(rstudioapi::document_position(6, 7), rstudioapi::document_position(6, 20)),
rstudioapi::document_range(rstudioapi::document_position(10, 1), rstudioapi::document_position(10, 2))
)
rstudioapi::setSelectionRanges(rgs)
rstudioapi::insertText(lapply(1:5, function(x) c(x, 8, x, 9)), "🤷")
rstudioapi::modifyRange(Map(c, 1:5, 1), paste0("#", sample(letters, 5), " "))
rstudioapi::showQuestion("Howdy there!", "I think you're great!!!", "😊", "😫")
rstudioapi::showDialog("Howdy there!", "It's time to visit a <i>very nice</i> website:", "https://posit.co/")
rstudioapi::sendToConsole("lm(mpg ~ ., data = mtcars)")
rstudioapi::restartSession()
rstudioapi::getActiveProject()
rstudioapi::documentNew("SELECT * FROM 1", type = "sql")
rstudioapi::openProject("/path/to/a/new/workspace/", TRUE)
rstudioapi::navigateToFile("/path/to/a/file.R") ## also works with relative paths
rstudioapi::executeCommand("activateTerminal")
# generates an info box for user:
rstudioapi::executeCommand("potato") Create an R file with this code |
If we come up with any new work needed for rstudioapi shims, let's open new issues. 👍 |
Are we going to link #2605 to this? Or do we view that as one of these new issues? |
Yes, we'll triage #2605 and decide whether to handle it for Public Beta. Thank you for the detailed info on the remaining problem! |
@juliasilge , will these be available from Python? I'm assuming this is an R package, and we'd need something separate for Python? |
These could eventually be made available to users in Python in the future, say if we decided to create a Python package |
Verified FixedPositron Version(s) : 2024.04.0-29 Test scenario(s)All the mentioned api calls work as expected. I didn't check all the possible for Link(s) to TestRail test cases run or created:Test 607955 - Not exhaustive, but will be expanded when automated. |
Positron Version:
Positron Version: 2023.09.0 (Universal) build 139
Code - OSS Version: 1.79.0
Commit: 7f5dc8c
Date: 2023-09-13T02:39:00.220Z
Electron: 22.3.10
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin arm64 22.6.0
Request
It'd be great to shim
rstudioapi
so that it works in vscode in a manner similar to how to works in RStudio. The vscode-R extension includes prior art and IIUC the development there was contributed by Miles McBain (a well-known R and vscode user).Understandable, not everything in rstudioapi can be shimmed, but here's a short list of minimal features:
The text was updated successfully, but these errors were encountered: