Skip to content

Commit

Permalink
[Plugin-Api] Add stub implementation of window.registerUriHandler()
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Vinokur <ivinokur@redhat.com>
  • Loading branch information
vinokurig committed May 20, 2019
1 parent 555bdb0 commit cfc6b36
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/plugin-ext/src/plugin/plugin-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ export function createAPIFactory(
console.error('Progress location \'SourceControl\' is not supported.');
});
}
},
registerUriHandler(handler: theia.UriHandler): theia.Disposable {
// TODO Apply full implementation https://github.com/theia-ide/theia/issues/5119
return new Disposable(() => {});
}
};

Expand Down
38 changes: 38 additions & 0 deletions packages/plugin/src/theia.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2940,6 +2940,21 @@ declare module '@theia/plugin' {
deserializeWebviewPanel(webviewPanel: WebviewPanel, state: any): PromiseLike<void>;
}

/**
* A uri handler is responsible for handling system-wide [uris](#Uri).
*
* @see [window.registerUriHandler](#window.registerUriHandler).
*/
export interface UriHandler {

/**
* Handle the provided system-wide [uri](#Uri).
*
* @see [window.registerUriHandler](#window.registerUriHandler).
*/
handleUri(uri: Uri): ProviderResult<void>;
}

/**
* Common namespace for dealing with window and editor, showing messages and user input.
*/
Expand Down Expand Up @@ -3372,6 +3387,29 @@ declare module '@theia/plugin' {
*/
export function createTreeView<T>(viewId: string, options: TreeViewOptions<T>): TreeView<T>;

/**
* Registers a [uri handler](#UriHandler) capable of handling system-wide [uris](#Uri).
* In case there are multiple windows open, the topmost window will handle the uri.
* A uri handler is scoped to the extension it is contributed from; it will only
* be able to handle uris which are directed to the extension itself. A uri must respect
* the following rules:
*
* - The uri-scheme must be the product name;
* - The uri-authority must be the extension id (eg. `my.extension`);
* - The uri-path, -query and -fragment parts are arbitrary.
*
* For example, if the `my.extension` extension registers a uri handler, it will only
* be allowed to handle uris with the prefix `product-name://my.extension`.
*
* An extension can only register a single uri handler in its entire activation lifetime.
*
* * *Note:* There is an activation event `onUri` that fires when a uri directed for
* the current extension is about to be handled.
*
* @param handler The uri handler to register for this extension.
*/
export function registerUriHandler(handler: UriHandler): Disposable;

/**
* Show progress in the editor. Progress is shown while running the given callback
* and while the promise it returned isn't resolved nor rejected. The location at which
Expand Down

0 comments on commit cfc6b36

Please sign in to comment.