You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I greatly appreciate the fact that some rstudioapi functions, like getSourceEditorContext() work in Positron. Thanks! But I do not think that insertText() works in Positron.
> rstudioapi::insertText(text = "hello")
Error:
! 'ranges' should be a list of 4-element integer vectors
Hide Traceback
▆
1. └─rstudioapi::insertText(text = "hello")
2. └─rstudioapi::callFun(...)
3. ├─base::do.call(f, args)
4. └─`<fn>`(location = NULL, text = "hello", id = NULL)
5. └─asRangeList(location)
6. └─base::lapply(...)
7. └─FUN(X[[i]], ...)
>
Are there plans to have insertText() work in Positron? In the meantime, what approach do you recommend for achieving this when using Positron instead of RStudio?
UPDATE I: I am not sure if this is relevant, but here is what happens when I run the same command in R at the Terminal:
> rstudioapi::insertText(text = "hello")
Error: RStudio not running
>
UPDATE II: ChatGPT suggested this approach:
rstudioapi::insertText(location = rstudioapi::getActiveDocumentContext()$selection[[1]]$range, text = "hello")
which does work. Feel free to close this issue if making the behavior of insertText() more similar across IDEs is not a priority.
Activity