mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 3.0.0 to 3.0.1. - [Release notes](https://github.com/chalk/ansi-regex/releases) - [Commits](https://github.com/chalk/ansi-regex/compare/v3.0.0...v3.0.1) --- updated-dependencies: - dependency-name: ansi-regex dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com>
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-samplevscode-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-samplevscode://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.registerUriHandlerenv.uriSchemeenv.asExternalUriUriHandler
Be sure to look at the API Docs for usage.
Running the Sample
- Open this example in VS Code Insiders
npm installnpm run watchF5to start debugging- Run the
Start handling Uriscommand