Skip to content

Commit

Permalink
Finalize registerTerminalLinkHandler API
Browse files Browse the repository at this point in the history
Fixes #91606
  • Loading branch information
Tyriar committed Apr 9, 2020
1 parent 7ca8791 commit 74ea30b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 23 deletions.
17 changes: 17 additions & 0 deletions src/vs/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7622,6 +7622,13 @@ declare module 'vscode' {
*/
export function createTerminal(options: ExtensionTerminalOptions): Terminal;

/**
* Register a [TerminalLinkHandler](#TerminalLinkHandler) that can be used to intercept and
* handle links that are activated within terminals.
* @param handler The link handler being registered.

This comment has been minimized.

Copy link
@jrieken

jrieken Apr 9, 2020

Member

@Tyriar incomplete jsdoc, misses @return, please copy&paste the test from somewhere

This comment has been minimized.

Copy link
@jrieken

jrieken Apr 15, 2020

Member

ping @Tyriar

This comment has been minimized.

Copy link
@Tyriar

Tyriar Apr 15, 2020

Author Member

done

This comment has been minimized.

Copy link
@jrieken

jrieken Apr 15, 2020

Member

Thanks. On a unrelated note, should it maybe called TerminalUriHandler and handleUri just like (Application)UriHandler?

This comment has been minimized.

Copy link
@Tyriar

Tyriar Apr 15, 2020

Author Member

It's a string though, not a uri. Example arguments:

file:///foo
http://microsoft.com
./foo.bar:10:2
../file:line 2, column 3
foo
literally_anything # as defined by wordSeparators
*/
export function registerTerminalLinkHandler(handler: TerminalLinkHandler): Disposable;

/**
* Register a [TreeDataProvider](#TreeDataProvider) for the view contributed using the extension point `views`.
* This will allow you to contribute data to the [TreeView](#TreeView) and update if the data changes.
Expand Down Expand Up @@ -8182,6 +8189,16 @@ declare module 'vscode' {
readonly code: number | undefined;
}

export interface TerminalLinkHandler {

This comment has been minimized.

Copy link
@jrieken

jrieken Apr 9, 2020

Member

incomplete jsdoc for

  • the interface itself
  • the arguments of the handleLink function
/**
* Handles a link that is activated within the terminal.
*
* @return Whether the link was handled, if the link was handled this link will not be
* considered by any other extension or by the default built-in link handler.
*/
handleLink(terminal: Terminal, link: string): ProviderResult<boolean>;
}

/**
* A location in the editor at which progress information can be shown. It depends on the
* location how progress is visually represented.
Expand Down
22 changes: 0 additions & 22 deletions src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -895,28 +895,6 @@ declare module 'vscode' {

//#endregion

//#region Terminal link handlers https://github.com/microsoft/vscode/issues/91606

export namespace window {
/**
* Register a [TerminalLinkHandler](#TerminalLinkHandler) that can be used to intercept and
* handle links that are activated within terminals.
*/
export function registerTerminalLinkHandler(handler: TerminalLinkHandler): Disposable;
}

export interface TerminalLinkHandler {
/**
* Handles a link that is activated within the terminal.
*
* @return Whether the link was handled, if the link was handled this link will not be
* considered by any other extension or by the default built-in link handler.
*/
handleLink(terminal: Terminal, link: string): ProviderResult<boolean>;
}

//#endregion

//#region Contribute to terminal environment https://github.com/microsoft/vscode/issues/46696

export enum EnvironmentVariableMutatorType {
Expand Down
1 change: 0 additions & 1 deletion src/vs/workbench/api/common/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostTerminalService.createTerminal(nameOrOptions, shellPath, shellArgs);
},
registerTerminalLinkHandler(handler: vscode.TerminalLinkHandler): vscode.Disposable {
checkProposedApiEnabled(extension);
return extHostTerminalService.registerLinkHandler(handler);
},
registerTreeDataProvider(viewId: string, treeDataProvider: vscode.TreeDataProvider<any>): vscode.Disposable {
Expand Down

0 comments on commit 74ea30b

Please sign in to comment.