Files
vscode-extension-samples/uri-handler-sample
dependabot[bot] f4f9206980 Bump minimist from 1.2.5 to 1.2.6 in /uri-handler-sample
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-01 18:35:12 +00:00
..
2021-05-11 16:32:09 -07:00
2021-05-11 16:32:09 -07:00
2021-05-11 16:32:09 -07:00
2021-05-11 16:32:09 -07:00
2022-02-28 13:45:21 -08:00

Uri Handlers

This sample demonstrates how to implement a Uri handler in VS Code. A Uri handler is run when a browser redirects to VS Code with a specific extension id as the authority.

Examples:

  • vscode://vscode-samples.uri-handler-sample
  • vscode-insiders://vscode-samples.uri-handler-sample

If you paste these Uris into your browser, they will open VS Code and VS Code insiders, respectively.

This sample provides a simple Uri handler that shows an information message when a Uri is handled. Additionally, if a query string was included in the Uri, it will include that in the message.

Run the sample and try opening the following Uris in your browser:

  • vscode://vscode-samples.uri-handler-sample
  • vscode://vscode-samples.uri-handler-sample?q=hello

Note: use vscode-insiders:// if you ran the sample in insiders.

VS Code API

This sample uses following APIs

APIs

  • window.registerUriHandler
  • env.uriScheme
  • env.asExternalUri
  • UriHandler

Be sure to look at the API Docs for usage.

Running the Sample

  • Open this example in VS Code Insiders
  • npm install
  • npm run watch
  • F5 to start debugging
  • Run the Start handling Uris command