Skip to content

Compatibility with Positron #20

@mkierczak

Description

@mkierczak

Hi!

Encountered a compatibility issue when trying to work with Positron. Apparently specific call to RStudio API breaks the execution. Any plans to port livecode to Positron?

> server <- livecode::serve_file()
✔ Started sharing 'livecode.qmd' at '[http://xx.xx.xx.xx:15192](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#)'.
✖ The current ip address ('xx.xx.xx.xx') for the server is private, only users on the same local network are likely to be able to connect.
Error in `.rs.readUiPref()`:
! could not find function ".rs.readUiPref"
Hide Traceback
    ▆
 1. └─livecode::serve_file()
 2.   └─lc_server_iface$new(...)
 3.     └─livecode (local) initialize(...)
 4.       └─private$init_auto_save()
 5.         └─livecode:::check_strip_trailing_ws()
 6.           └─livecode:::get_option("strip_trailing_whitespace", default = FALSE)
 7.             └─.rs.readUiPref(x) %||% default

Further investigation reveals:

> livecode:::is_rstudio()
[1] TRUE

while working in Positron.

Suggested possible solution:

is_rstudio2 <- function() {
  attempt <- try(
    expr = requireNamespace("rstudioapi", quietly = TRUE) && rstudioapi::launcherGetInfo(), 
    silent = T)
  if(inherits(attempt, "try-error")) {
    return(FALSE)
  } else {
    return(TRUE)
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions