-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Test: Protocol handler API #48427
Copy link
Copy link
Closed
Labels
Milestone
Description
Test for #46256:
- windows: @sbatten
- macOS: @weinand
linux: @ramya-rao-a
Complexity: 3
Authors: @joaomoreno
Setup
First, make sure your extension sets "enableProposedApi": true in its manifest. Then, get the latest definitions:
- Change the
engine.vscodeproperty to*inpackage.json - Run
npm run postinstall - Undo step 1
URI Format
Uris directed towards extension vscode.git, for example, all share the following prefix:
{scheme}://vscode.git
(with vscode.git being the extension id).
For example, for VS Code Insiders, these are valid Uris which will be handled by the git extension's protocol handler:
vscode-insiders://vscode.git
vscode-insiders://vscode.git/
vscode-insiders://vscode.git/status
vscode-insiders://vscode.git/clone?url=foobar
Test Details
As an extension author, you can:
- Use the new ProtocolHandler proposed API, to handle such Uris
- Use a new activation event
onUrito be activated when a Uri for that extension is opened. This should work in all cases:- A Code window is open
- No Code windows are open, but Code is running (macOS)
- Code is not running at all
- As a user, you should be prompted to confirm opening Urls directed to extensions
Here's how you can test Uri opening:
- Windows: type
explorer URIin a command prompt - macOS: type
open URIin a shell - Linux: type
xdg-open URIin a shell
You can also open a URL from the command line with --open-url URL. This can be used simultaneously with --enable-proposed-api.
Reactions are currently unavailable