|
5 | 5 |
|
6 | 6 | import * as vscode from 'vscode';
|
7 | 7 |
|
8 |
| -import { LOGGER } from './extension'; |
9 | 8 | import { RSessionManager } from './session-manager';
|
10 | 9 | import { EnvVar, RSession } from './session';
|
11 | 10 |
|
12 | 11 | export async function registerUriHandler() {
|
13 | 12 | vscode.window.registerUriHandler({ handleUri });
|
14 | 13 | }
|
15 | 14 |
|
16 |
| -// Temporary feature flag to finesse the fact that cli hyperlinks are either all ON or all OFF. |
17 |
| -// cli 3.6.3.9001 gained support for configuring the URL format of run/help/vignette hyperlinks. |
18 |
| -// But file hyperlinks are not yet configurable and will delegate to operating system. |
19 |
| -// If the user still has RStudio as the app associated with .R files, it will open in RStudio. |
20 |
| -// Flag will be removed once cli can be configured to emit positron://file/... hyperlinks. |
21 |
| -function taskHyperlinksEnabled(): boolean { |
22 |
| - const extConfig = vscode.workspace.getConfiguration('positron.r'); |
23 |
| - const taskHyperlinksEnabled = extConfig.get<boolean>('taskHyperlinks'); |
24 |
| - |
25 |
| - return taskHyperlinksEnabled === true; |
26 |
| -} |
27 |
| - |
28 | 15 | // Example of a URI we expect to handle:
|
29 | 16 | // positron://positron.positron-r/cli?command=x-r-run:testthat::snapshot_review('snap')
|
30 | 17 | //
|
@@ -72,21 +59,20 @@ export async function prepCliEnvVars(session?: RSession): Promise<EnvVar> {
|
72 | 59 | return {};
|
73 | 60 | }
|
74 | 61 |
|
75 |
| - const taskHyperlinks = taskHyperlinksEnabled(); |
76 |
| - const cliPkg = await session.packageVersion('cli', '3.6.3.9001'); |
| 62 | + const cliPkg = await session.packageVersion('cli', '3.6.3.9002'); |
77 | 63 | const cliSupportsHyperlinks = cliPkg?.compatible ?? false;
|
78 | 64 |
|
79 |
| - if (!taskHyperlinks || !cliSupportsHyperlinks) { |
| 65 | + if (!cliSupportsHyperlinks) { |
80 | 66 | // eslint-disable-next-line @typescript-eslint/naming-convention
|
81 | 67 | return { R_CLI_HYPERLINKS: 'FALSE' };
|
82 | 68 | }
|
83 | 69 |
|
84 | 70 | return {
|
85 | 71 | /* eslint-disable @typescript-eslint/naming-convention */
|
86 | 72 | R_CLI_HYPERLINKS: 'TRUE',
|
| 73 | + R_CLI_HYPERLINK_FILE_URL_FORMAT: 'positron://file{path}:{line}:{column}', |
87 | 74 | // TODO: I'd like to request POSIX compliant hyperlinks in the future, but currently
|
88 |
| - // cli's tests implicitly assume the default and there are more important changes to |
89 |
| - // propose in cli, such as tweaks to file hyperlinks. Leave this alone for now. |
| 75 | + // cli's tests implicitly assume the default. Doesn't seem worth the fuss at this time. |
90 | 76 | // R_CLI_HYPERLINK_MODE: "posix",
|
91 | 77 | R_CLI_HYPERLINK_RUN: 'TRUE',
|
92 | 78 | R_CLI_HYPERLINK_RUN_URL_FORMAT: 'positron://positron.positron-r/cli?command=x-r-run:{code}',
|
|
0 commit comments