Closed mjbvz closed 4 years ago
Tested on Linux with a Node Docker Container. HTTP, HTTPS, no issues found.
@mattbierner I don't understand the last paragraph: How is vscode.env.uriScheme
is related to the tunneling. asExternalUri
specs it only works with http
and https
, how could I use the 'uriScheme' ?
Also tested remotes running in WSL1 and WSL2. Extended sample code: https://github.com/aeschli/vscode-test-asExternalUri/tree/aeschli/test
Tested under Remote WSL.
What is meant by "In addition, handles vscode:
uris specially for embedders."?
See #82884, the previously proposed env.createAppUri
api was merged into vscode.env.asExternalUri
@bpasero Any advice on testing this besides the example outlined in the documentation?
Tested on MacOS with Linux over SSH and Windows over SSH.
I think @RMacfarlane uncovered issues with app URIs so I think this can currently not be verified.
Test for #82896
Complexity: 4
Overview
This iteration,
vscode.env.asExternalUri
was finalized. This api lets extensions resolve a uri in the local environment to one in the client environment. If the extension is running remote, resolving a localhost uri will automatically open a tunnel that the client can use to connect to the requested port on the remote.The
asExternalUri
function should use the same basic logic as theopenExternalUri
api, however instead of opening the uri in the browser, it returns the resulting uri to the extension.In addition, handles
vscode:
uris specially for embedders.Testing
Write a simple extension that uses
asExternalUri
. I've provided an example here: https://github.com/mjbvz/vscode-test-asExternalUriUsing this test extension, check the following:
When the extension is run locally,
asExternalUri
returns the inputWhen the extension is run remotely,
asExternalUri
should open a tunnel forhttp
/https
localhost uris (bothlocalhost
and127.0.0.1
)Resolving the same uri multiple time should return the same result.
The tunnels should get cleaned up when the client window is closed
Multiple instances of VS Code should be able to resolve the same localhost uri (each instance should get its own resolved result however)
Tunnels should never be opened for non-localhost uris
Review the jsdoc for
asExternalUri
. Can you understand how the api works from these docs?Test the api using
vscode.env.uriScheme
uris schemes as documented by registering a uri handler and verifying your extension is being called aftervscode.env.openExternal