Skip to content

Commit

Permalink
implement View, closes #44 (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
romainfrancois authored Dec 8, 2023
1 parent cf90397 commit e0a22cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 9 additions & 3 deletions share/jupyter/kernels/xr/resources/routines.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,23 @@ update_display_data <- function(data = NULL, metadata = NULL) {
}

kernel_info_request <- function() {
.Call("xeusr_kernel_info_request", PACKAGE = "(embedding)")
.Call("xeusr_kernel_info_request", PACKAGE = "(embedding)")
}

clear_output <- function(wait = FALSE) {
invisible(.Call("xeusr_clear_output", isTRUE(wait), PACKAGE = "(embedding)"))
invisible(.Call("xeusr_clear_output", isTRUE(wait), PACKAGE = "(embedding)"))
}

is_complete_request <- function(code) {
.Call("xeusr_is_complete_request", code, PACKAGE = "(embedding)")
}

cell_options <- function(...) {
rlang::local_options(..., .frame = .xeusr_private_env$frame_cell_execute)
rlang::local_options(..., .frame = .xeusr_private_env$frame_cell_execute)
}

View <- function(x, title) {
if (!missing(title)) IRdisplay::display_text(title)
IRdisplay::display(x)
invisible(x)
}
3 changes: 2 additions & 1 deletion test/test_xr_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class KernelTests(jupyter_kernel_test.KernelTests):
code_execute_result = [{"code": "6*7", "result": ["[1] 42"]}]
code_display_data = [
{"code": "plot(0)", "mime": "image/png"},
{"code": "ggplot2::ggplot(iris, ggplot2::aes(Sepal.Length, Sepal.Width)) + ggplot2::geom_point()", "mime": "image/png"}
{"code": "ggplot2::ggplot(iris, ggplot2::aes(Sepal.Length, Sepal.Width)) + ggplot2::geom_point()", "mime": "image/png"},
{"code": "View(head(iris))", "mime": "text/html"}
]

# code_page_something = "?cat"
Expand Down

0 comments on commit e0a22cd

Please sign in to comment.