You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new vscode.env.asExternalUri proposed 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 the openExternalUri api, however instead of opening the uri in the browser, it returns the resulting uri to the extension.
Test for #81131
Complexity: 4
Overview
The new
vscode.env.asExternalUri
proposed 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.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?The text was updated successfully, but these errors were encountered: