UNPKG

xterm-link-provider

Version:
29 lines (28 loc) 1.38 kB
import type { ILink, ILinkProvider, Terminal } from '@xterm/xterm'; type ILinkProviderOptions = Omit<ILink, 'range' | 'text' | 'activate'>; export declare class LinkProvider implements ILinkProvider { private readonly _terminal; private readonly _regex; private readonly _handler; private readonly _options; private readonly _matchIndex; /** * Create a Link Provider for xterm.js * @param _terminal The terminal instance * @param _regex The regular expression to use for matching * @param _handler Callback for when link is clicked * @param _options Further hooks, eg. hover, leave and decorations * @param _matchIndex The index to use from regexp.exec result, default 1 */ constructor(_terminal: Terminal, _regex: RegExp, _handler: ILink['activate'], _options?: ILinkProviderOptions, _matchIndex?: number); provideLinks(y: number, callback: (links: ILink[] | undefined) => void): void; } /** * Find link range and text for the given line and regex * @param y The line number to process * @param regex The regular expression to use for matching * @param terminal The terminal instance * @param matchIndex The index to use from regexp.exec result, default 1 */ export declare const computeLink: (y: number, regex: RegExp, terminal: Terminal, matchIndex?: number) => Pick<ILink, "text" | "range">[]; export {};