Skip to content

Commit bc1b073

Browse files
authored
Merge pull request #1869 from rstudio/fix/positron-restart
Fixes Positron restart
2 parents 7890da2 + 8e93662 commit bc1b073

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

R/thread.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ py_run_file_on_thread <- function(file, ..., args = NULL) {
6262
basename(dirname(file)) %in% c("positron", "posit"))
6363

6464
if (launching_lsp) {
65+
# this is equivalent to the result of .getIpykernelPath UI command.
66+
.globals$positron_ipykernel_path <- file.path(dirname(file), "positron")
67+
6568
main_dict <- py_eval("__import__('__main__').__dict__.copy()", FALSE)
6669
py_get_attr(main_dict, "pop")("__annotations__")
6770
# IPykernel will create a thread that redirects all output from fileno of

R/zzz.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ register_ark_methods <- function() {
8989
# which will be needed for the variable inspectors and for help handlers
9090
# this can'rt be executed during handling of RPC's, so it's important that it's cached.
9191
.ps.ui.executeCommand <- get(".ps.ui.executeCommand", globalenv())
92-
.globals$positron_ipykernel_path <- .ps.ui.executeCommand("positron.reticulate.getIPykernelPath")
92+
if (is.null(.globals$positron_ipykernel_path)) {
93+
.globals$positron_ipykernel_path <- .ps.ui.executeCommand("positron.reticulate.getIPykernelPath")
94+
}
9395

9496
# register help handler
9597
tryCatch({

0 commit comments

Comments
 (0)