Open jmcphers opened 1 month ago
There's definitely some overlap here with the existing logic in the Posit Workbench extension, which already has logic for discovering localhost URLs and creating proxies for them. We could choose to re-use some of that code, or refactor that code to use the resolver APIs.
Positron currently uses localhost URLs to serve content in many places.
These URLs won't be visible to browsers by default in Workbench; they will need to get transformed into proxied Posit Workbench URLs at some point so that they can be loaded in the browser.
One way to do this might be to use the resolver API, which is part of VS Code upstream and is defined here:
https://github.com/posit-dev/positron/blob/main/src/vscode-dts/vscode.proposed.resolvers.d.ts
Using this API allows us to request that any registered resolvers process the URL before we load it in Positron. Here's an example of where we call the API on the Positron side:
https://github.com/posit-dev/positron/blob/de62b4ee561390e86d0ea5f0d9c09a40d976a80a/src/vs/workbench/services/languageRuntime/common/languageRuntimeUiClient.ts#L155-L161
So a solution could look like this. Here I'm using "Help Server" as an example, but this is akin to what we need to do for each local URL.