From 3003dd79b90c9eea297d578083c65dee4a4c9734 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Fri, 20 Dec 2024 16:33:18 -0800 Subject: [PATCH 1/3] Configure cli file hyperlinks for R package dev tasks --- extensions/positron-r/src/uri-handler.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/positron-r/src/uri-handler.ts b/extensions/positron-r/src/uri-handler.ts index 3e85cb0c296..402cd9ee747 100644 --- a/extensions/positron-r/src/uri-handler.ts +++ b/extensions/positron-r/src/uri-handler.ts @@ -73,7 +73,7 @@ export async function prepCliEnvVars(session?: RSession): Promise { } const taskHyperlinks = taskHyperlinksEnabled(); - const cliPkg = await session.packageVersion('cli', '3.6.3.9001'); + const cliPkg = await session.packageVersion('cli', '3.6.3.9002'); const cliSupportsHyperlinks = cliPkg?.compatible ?? false; if (!taskHyperlinks || !cliSupportsHyperlinks) { @@ -84,6 +84,7 @@ export async function prepCliEnvVars(session?: RSession): Promise { return { /* eslint-disable @typescript-eslint/naming-convention */ R_CLI_HYPERLINKS: 'TRUE', + R_CLI_HYPERLINK_FILE_URL_FORMAT: 'positron://file{path}:{line}:{column}', // TODO: I'd like to request POSIX compliant hyperlinks in the future, but currently // cli's tests implicitly assume the default and there are more important changes to // propose in cli, such as tweaks to file hyperlinks. Leave this alone for now. From ec733210aa871f7d86342f3e8dbc0563dba3f9dc Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Fri, 20 Dec 2024 17:09:50 -0800 Subject: [PATCH 2/3] Remove the temporary feature flag --- extensions/positron-r/package.json | 6 ------ extensions/positron-r/package.nls.json | 1 - extensions/positron-r/src/uri-handler.ts | 16 +--------------- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/extensions/positron-r/package.json b/extensions/positron-r/package.json index e7afbc96fdd..eb8e6427753 100644 --- a/extensions/positron-r/package.json +++ b/extensions/positron-r/package.json @@ -273,12 +273,6 @@ "default": [], "description": "%r.configuration.extraArguments.description%" }, - "positron.r.taskHyperlinks": { - "scope": "window", - "type": "boolean", - "default": false, - "description": "%r.configuration.taskHyperlinks.description%" - }, "positron.r.defaultRepositories": { "scope": "window", "type": "string", diff --git a/extensions/positron-r/package.nls.json b/extensions/positron-r/package.nls.json index f07e37fdafa..e869bafdc97 100644 --- a/extensions/positron-r/package.nls.json +++ b/extensions/positron-r/package.nls.json @@ -59,7 +59,6 @@ "r.configuration.pipe.native.description": "Native pipe available in R >= 4.1", "r.configuration.pipe.magrittr.description": "Pipe operator from the magrittr package, re-exported by many other packages", "r.configuration.diagnostics.enable.description": "Enable R diagnostics globally", - "r.configuration.taskHyperlinks.description": "Turn on experimental support for hyperlinks in package development tasks", "r.configuration.defaultRepositories.description": "The default repositories to use for R package installation, if no repository is otherwise specified in R startup scripts (restart Positron to apply).\n\nThe default repositories will be set as the `repos` option in R.", "r.configuration.defaultRepositories.auto.description": "Automatically choose a default repository, or use a repos.conf file if it exists.", "r.configuration.defaultRepositories.rstudio.description": "Use the RStudio CRAN mirror (cran.rstudio.com)", diff --git a/extensions/positron-r/src/uri-handler.ts b/extensions/positron-r/src/uri-handler.ts index 402cd9ee747..15f19bdb2a8 100644 --- a/extensions/positron-r/src/uri-handler.ts +++ b/extensions/positron-r/src/uri-handler.ts @@ -5,7 +5,6 @@ import * as vscode from 'vscode'; -import { LOGGER } from './extension'; import { RSessionManager } from './session-manager'; import { EnvVar, RSession } from './session'; @@ -13,18 +12,6 @@ export async function registerUriHandler() { vscode.window.registerUriHandler({ handleUri }); } -// Temporary feature flag to finesse the fact that cli hyperlinks are either all ON or all OFF. -// cli 3.6.3.9001 gained support for configuring the URL format of run/help/vignette hyperlinks. -// But file hyperlinks are not yet configurable and will delegate to operating system. -// If the user still has RStudio as the app associated with .R files, it will open in RStudio. -// Flag will be removed once cli can be configured to emit positron://file/... hyperlinks. -function taskHyperlinksEnabled(): boolean { - const extConfig = vscode.workspace.getConfiguration('positron.r'); - const taskHyperlinksEnabled = extConfig.get('taskHyperlinks'); - - return taskHyperlinksEnabled === true; -} - // Example of a URI we expect to handle: // positron://positron.positron-r/cli?command=x-r-run:testthat::snapshot_review('snap') // @@ -72,11 +59,10 @@ export async function prepCliEnvVars(session?: RSession): Promise { return {}; } - const taskHyperlinks = taskHyperlinksEnabled(); const cliPkg = await session.packageVersion('cli', '3.6.3.9002'); const cliSupportsHyperlinks = cliPkg?.compatible ?? false; - if (!taskHyperlinks || !cliSupportsHyperlinks) { + if (!cliSupportsHyperlinks) { // eslint-disable-next-line @typescript-eslint/naming-convention return { R_CLI_HYPERLINKS: 'FALSE' }; } From 6ea7a387f4d1dbd9ab7ef16f23245036c898d471 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Fri, 10 Jan 2025 13:48:28 -0800 Subject: [PATCH 3/3] Update comment --- extensions/positron-r/src/uri-handler.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/extensions/positron-r/src/uri-handler.ts b/extensions/positron-r/src/uri-handler.ts index 15f19bdb2a8..89d194223d0 100644 --- a/extensions/positron-r/src/uri-handler.ts +++ b/extensions/positron-r/src/uri-handler.ts @@ -72,8 +72,7 @@ export async function prepCliEnvVars(session?: RSession): Promise { R_CLI_HYPERLINKS: 'TRUE', R_CLI_HYPERLINK_FILE_URL_FORMAT: 'positron://file{path}:{line}:{column}', // TODO: I'd like to request POSIX compliant hyperlinks in the future, but currently - // cli's tests implicitly assume the default and there are more important changes to - // propose in cli, such as tweaks to file hyperlinks. Leave this alone for now. + // cli's tests implicitly assume the default. Doesn't seem worth the fuss at this time. // R_CLI_HYPERLINK_MODE: "posix", R_CLI_HYPERLINK_RUN: 'TRUE', R_CLI_HYPERLINK_RUN_URL_FORMAT: 'positron://positron.positron-r/cli?command=x-r-run:{code}',