Skip to content

Commit e6b19c1

Browse files
authored
Remove to_html stub (#1132)
The recent change that added inline data explorers for R caused a regression in printing data frames at the R console. Ark contains a stub for printing data frames that just says `Hello, world!` Before the PR, it was dead code because the old code looked for `.Last.value` in `R_GlobalEnv` (where it doesn't exist), while R stores it in the base environment. The new code correctly uses` harp::environment::last_value()` which finds it in the base env, so now the stub actually gets called for data frames. The fix here is to remove the stub entirely since it doesn't do anything useful. We can add it back if we decided to implement HTML/tabular output for data frames properly. Will address posit-dev/positron#12799.
1 parent e7ecac6 commit e6b19c1

2 files changed

Lines changed: 1 addition & 29 deletions

File tree

crates/ark/src/console/console_repl.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,18 +1158,10 @@ impl Console {
11581158
return data;
11591159
}
11601160

1161-
// If this is a data frame, add HTML representation and open inline explorer
1161+
// If this is a data frame, optionally open an inline data explorer
11621162
// (only in Positron notebook mode)
11631163
if r_is_data_frame(value.sexp) {
11641164
let value = value.sexp;
1165-
match to_html(value) {
1166-
Ok(html) => {
1167-
data.insert("text/html".to_string(), json!(html));
1168-
},
1169-
Err(err) => {
1170-
log::error!("{err:?}");
1171-
},
1172-
};
11731165

11741166
// The inline data explorer is a Positron-specific feature that
11751167
// requires comm support. Other Jupyter frontends don't understand
@@ -2426,15 +2418,6 @@ impl Console {
24262418
}
24272419
}
24282420

2429-
/// Converts a data frame to HTML
2430-
fn to_html(frame: SEXP) -> Result<String> {
2431-
let result = RFunction::from(".ps.format.toHtml")
2432-
.add(frame)
2433-
.call()?
2434-
.to::<String>()?;
2435-
Ok(result)
2436-
}
2437-
24382421
// Inputs generated by `ReadConsole` for the LSP
24392422
pub(crate) fn console_inputs() -> anyhow::Result<ConsoleInputs> {
24402423
// TODO: Should send the debug environment if debugging:

crates/ark/src/modules/positron/format.R

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)