posit-dev / positron

Positron, a next-generation data science IDE
https://positron.posit.co
Other
2.82k stars 90 forks source link

Make file hyperlinks open in Positron in R package dev tasks #5409

Open jennybc opened 3 days ago

jennybc commented 3 days ago

Various R package dev tasks can emit file hyperlinks, e.g. to the exact location of a failing test. In our integrated terminals, these links currently have a form that leads to them being handled by the operating system. For many long time R users, this will mean that clicking on such a link opens the file in RStudio!

However, VS Code and, therefore, Positron, have a URL scheme that can communicate "open this file (location) in this product":

https://code.visualstudio.com/docs/editor/command-line#_opening-vs-code-with-urls

General form:

{product}://file{some/absolute/path}

You can experience this in VS Code by executing this in a terminal (substitute the path to a specific file on your computer):

printf '\e]8;;vscode://file/Users/jenny/rrr/cli/DESCRIPTION\e\\DESCRIPTION file\e]8;;\e\n' 

Or likewise in Positron:

printf '\e]8;;positron://file/Users/jenny/rrr/cli/DESCRIPTION\e\\DESCRIPTION file\e]8;;\e\n' 

Positron or the positron-r extension should signal to amenable 3rd parties (such as the cli package) that this form of for file URLs is supported. Similar to #5218, this is going to require associated work in cli.