mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-29 00:46:00 +01:00
@@ -179,6 +179,24 @@ export interface ITerminalInstance {
|
||||
*/
|
||||
dispose(): void;
|
||||
|
||||
/**
|
||||
* Registers a link matcher, allowing custom link patterns to be matched and handled.
|
||||
* @param regex The regular expression the search for, specifically this searches the
|
||||
* textContent of the rows. You will want to use \s to match a space ' ' character for example.
|
||||
* @param handler The callback when the link is called.
|
||||
* @param matchIndex The index of the link from the regex.match(html) call. This defaults to 0
|
||||
* (for regular expressions without capture groups).
|
||||
* @return The ID of the new matcher, this can be used to deregister.
|
||||
*/
|
||||
registerLinkMatcher(regex: RegExp, handler: (url: string) => void, matchIndex?: number): number;
|
||||
|
||||
/**
|
||||
* Deregisters a link matcher if it has been registered.
|
||||
* @param matcherId The link matcher's ID (returned after register)
|
||||
* @return Whether a link matcher was found and deregistered.
|
||||
*/
|
||||
deregisterLinkMatcher(matcherId: number): void;
|
||||
|
||||
/**
|
||||
* Check if anything is selected in terminal.
|
||||
*/
|
||||
|
||||
@@ -225,6 +225,14 @@ export class TerminalInstance implements ITerminalInstance {
|
||||
this.updateConfig();
|
||||
}
|
||||
|
||||
public registerLinkMatcher(regex: RegExp, handler: (url: string) => void, matchIndex?: number): number {
|
||||
return this._xterm.registerLinkMatcher(regex, handler, matchIndex);
|
||||
}
|
||||
|
||||
public deregisterLinkMatcher(linkMatcherId: number): void {
|
||||
this._xterm.deregisterLinkMatcher(linkMatcherId);
|
||||
}
|
||||
|
||||
public hasSelection(): boolean {
|
||||
return !document.getSelection().isCollapsed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user