Skip to content

Commit

Permalink
Open files via Jupyter instead of LSP (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
lionel- authored May 29, 2024
1 parent b0375b2 commit be27e88
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 89 deletions.
1 change: 0 additions & 1 deletion crates/ark/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ pub struct RMain {

// LSP tokio runtime used to spawn LSP tasks on the executor and the
// corresponding backend used to send LSP requests to the frontend.
// Used by R callbacks, like `ps_editor()` for `utils::file.edit()`.
// The backend is initialized on LSP start up, and is refreshed after a
// frontend reconnect.
lsp_runtime: Arc<Runtime>,
Expand Down
84 changes: 0 additions & 84 deletions crates/ark/src/lsp/editor.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/ark/src/lsp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub mod definitions;
pub mod diagnostics;
pub mod document_context;
pub mod documents;
pub mod editor;
pub mod encoding;
pub mod events;
pub mod handler;
Expand Down
6 changes: 5 additions & 1 deletion crates/ark/src/modules/positron/editor.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ handler_editor <- function(file, title, ..., name = NULL) {
ensure_file(file)

# Edit those files.
.ps.Call("ps_editor", file, title)
for (f in file) {
# This blocks until a response from the frontend, unlike RStudio which
# uses a fire-and-forget event. This shouldn't cause any issues.
.ps.ui.navigateToFile(f)
}

invisible()
}
5 changes: 4 additions & 1 deletion crates/ark/src/modules/positron/frontend-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#
#

# TODO: Unexport these methods

#' @export
.ps.ui.LastActiveEditorContext <- function() {
.ps.Call("ps_ui_last_active_editor_context")
Expand All @@ -31,7 +33,8 @@
}

#' @export
.ps.ui.navigateToFile <- function(file, line, column) {
.ps.ui.navigateToFile <- function(file = character(0), line = -1L, column = -1L) {
file <- normalizePath(file)
.ps.Call("ps_ui_navigate_to_file", file, line, column)
}

Expand Down
1 change: 0 additions & 1 deletion crates/ark/src/modules/rstudio/stubs.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# TODO: support moveCursor argument
stopifnot(moveCursor)

file <- normalizePath(file)
invisible(.ps.ui.navigateToFile(file, line, column))
}

Expand Down

0 comments on commit be27e88

Please sign in to comment.