Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions R/profile.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ local({
})

if (requireNamespace("sess", quietly = TRUE)) {
sess::sess_app(
port = as.integer(Sys.getenv("SESS_PORT")),
token = Sys.getenv("SESS_TOKEN"),
sess::connect(
use_rstudioapi = as.logical(Sys.getenv("SESS_RSTUDIOAPI", "TRUE")),
use_httpgd = as.logical(Sys.getenv("SESS_USE_HTTPGD", "TRUE"))
)
Expand Down
2 changes: 1 addition & 1 deletion sess/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ Imports:
methods,
rstudioapi,
svglite
RoxygenNote: 7.3.3
Config/roxygen2/version: 8.0.0
2 changes: 1 addition & 1 deletion sess/NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by roxygen2: do not edit by hand

export(connect)
export(notify_client)
export(register_hooks)
export(request_client)
export(sess_app)
8 changes: 4 additions & 4 deletions sess/R/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' be enabled? Defaults to TRUE.
#' @param use_httpgd Logical. Should httpgd be used for plotting if available? Defaults to TRUE
#' @export
sess_app <- function(port = NULL, token = NULL, use_rstudioapi = TRUE, use_httpgd = TRUE) {
connect <- function(port = NULL, token = NULL, use_rstudioapi = TRUE, use_httpgd = TRUE) {
# Initialize state
.sess_env$server <- NULL
.sess_env$ws <- NULL
Expand Down Expand Up @@ -55,7 +55,7 @@ sess_app <- function(port = NULL, token = NULL, use_rstudioapi = TRUE, use_httpg
cat(sprintf("\r%s\n\n%s", msg, prompt))
}

connect <- function() {
do_connect <- function() {
url <- sprintf("ws://127.0.0.1:%s/?token=%s", port, token)
ws <- websocket::WebSocket$new(
url,
Expand Down Expand Up @@ -152,7 +152,7 @@ sess_app <- function(port = NULL, token = NULL, use_rstudioapi = TRUE, use_httpg
token <<- config$token
}, error = function(e) NULL)
}
connect()
do_connect()
}, 5)
})

Expand All @@ -164,7 +164,7 @@ sess_app <- function(port = NULL, token = NULL, use_rstudioapi = TRUE, use_httpg
}

# Connect to VS Code
connect()
do_connect()

# Register runtime hooks
if (is.na(use_rstudioapi)) use_rstudioapi <- TRUE
Expand Down
12 changes: 7 additions & 5 deletions sess/man/sess_app.Rd → sess/man/connect.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ export async function sessionRequest(server: SessionServer, data: Record<string,

export async function connectToSession(): Promise<void> {
const { port, token } = await getGlobalSessionServer();
const command = `sess::sess_app(port=${port}, token="${token}")`;
const command = `sess::connect(port=${port}, token="${token}")`;
void vscode.env.clipboard.writeText(command);
void vscode.window.showInformationMessage(`R command copied to clipboard: ${command}`);
}
Loading