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

Behavior of options(browse =) outside of Positron #588

Open
DavisVaughan opened this issue Oct 15, 2024 · 0 comments
Open

Behavior of options(browse =) outside of Positron #588

DavisVaughan opened this issue Oct 15, 2024 · 0 comments

Comments

@DavisVaughan
Copy link
Contributor

Right now we always override options(browse =) and add our special Positron specific behavior. This isn't great for Jupyter kernels

unsafe fn ps_browse_url_impl(url: SEXP) -> anyhow::Result<SEXP> {
// Extract URL.
let url = RObject::view(url).to::<String>()?;
let _span = tracing::trace_span!("browseURL", url = %url).entered();
// Handle help server requests.
if is_help_url(&url) {
log::trace!("Help is handling URL");
handle_help_url(url)?;
return Ok(Rf_ScalarLogical(1));
} else {
log::trace!("Help is not handling URL");
}
// For all other URLs, create a ShowUrl event and send it to the main
// thread; Positron will handle it.
let params = ShowUrlParams { url };
let event = UiFrontendEvent::ShowUrl(params);
RMain::with(|main| main.send_frontend_event(event));
Ok(Rf_ScalarLogical(1))
}

From @lionel-

The right thing to do outside Positron is to use the default action, i.e. open in a web browser. So we should not set up that option unless Positron is connected. Ideally Positron would inject the option via its init file. Or the UI comm could launch an idle task to do it, but there would a short time where the option is not set with this approach.

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

No branches or pull requests

1 participant