@@ -6433,22 +6433,51 @@ declare module 'vscode' {
64336433 export function openExternal ( target : Uri ) : Thenable < boolean > ;
64346434
64356435 /**
6436+ * Resolves a uri to form that is accessible externally. Currently only supports `https:`, `http:` and
6437+ * `vscode.env.uriScheme` uris.
6438+ *
6439+ * #### `http:` or `https:` scheme
6440+ *
64366441 * Resolves an *external* uri, such as a `http:` or `https:` link, from where the extension is running to a
64376442 * uri to the same resource on the client machine.
64386443 *
6439- * This is a no-op if the extension is running on the client machine. Currently only supports
6440- * `https:` and `http:` uris.
6444+ * This is a no-op if the extension is running on the client machine.
64416445 *
64426446 * If the extension is running remotely, this function automatically establishes a port forwarding tunnel
64436447 * from the local machine to `target` on the remote and returns a local uri to the tunnel. The lifetime of
64446448 * the port fowarding tunnel is managed by VS Code and the tunnel can be closed by the user.
64456449 *
6446- * Extensions should not cache the result of `asExternalUri` as the resolved uri may become invalid due to
6447- * a system or user action — for example, in remote cases, a user may close a port forwardng tunnel
6448- * that was opened by `asExternalUri`.
6450+ * *Note* that uris passed through `openExternal` are automatically resolved and you should not call `asExternalUri` on them.
6451+ *
6452+ * #### `vscode.env.uriScheme`
6453+ *
6454+ * Creates a uri that - if opened in a browser (e.g. via `openExternal`) - will result in a registered [UriHandler](#UriHandler)
6455+ * to trigger.
6456+ *
6457+ * Extensions should not make any assumptions about the resulting uri and should not alter it in anyway.
6458+ * Rather, extensions can e.g. use this uri in an authentication flow, by adding the uri as callback query
6459+ * argument to the server to authenticate to.
6460+ *
6461+ * *Note* that if the server decides to add additional query parameters to the uri (e.g. a token or secret), it
6462+ * will appear in the uri that is passed to the [UriHandler](#UriHandler).
6463+ *
6464+ * **Example** of an authentication flow:
6465+ * ```typescript
6466+ * vscode.window.registerUriHandler({
6467+ * handleUri(uri: vscode.Uri): vscode.ProviderResult<void> {
6468+ * if (uri.path === '/did-authenticate') {
6469+ * console.log(uri.toString());
6470+ * }
6471+ * }
6472+ * });
6473+ *
6474+ * const callableUri = await vscode.env.asExternalUri(vscode.Uri.parse(`${env.uriScheme}:://my.extension/did-authenticate`));
6475+ * await vscode.env.openExternal(callableUri);
6476+ * ```
64496477 *
6450- * *Note* that uris passed through `openExternal` are automatically resolved and you should not call `asExternalUri`
6451- * on them.
6478+ * *Note* that extensions should not cache the result of `asExternalUri` as the resolved uri may become invalid due to
6479+ * a system or user action — for example, in remote cases, a user may close a port forwarding tunnel that was opened by
6480+ * `asExternalUri`.
64526481 *
64536482 * @return A uri that can be used on the client machine.
64546483 */
0 commit comments