Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: Protocol handler API #48427

Closed
2 tasks done
joaomoreno opened this issue Apr 23, 2018 · 1 comment
Closed
2 tasks done

Test: Protocol handler API #48427

joaomoreno opened this issue Apr 23, 2018 · 1 comment

Comments

@joaomoreno
Copy link
Member

joaomoreno commented Apr 23, 2018

Test for #46256:

Complexity: 3

Authors: @joaomoreno


Setup

First, make sure your extension sets "enableProposedApi": true in its manifest. Then, get the latest definitions:

  1. Change the engine.vscode property to * in package.json
  2. Run npm run postinstall
  3. 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 onUri to 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 URI in a command prompt
  • macOS: type open URI in a shell
  • Linux: type xdg-open URI in 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.

@joaomoreno
Copy link
Member Author

I've removed Linux, since URL handlers are not yet supported by Code: #48528

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants