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

9012-registerTerminalLinkProvider-stub: for vscode-java-debug #9048

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/plugin-ext/src/plugin/plugin-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,9 @@ export function createAPIFactory(
createInputBox(): theia.InputBox {
return quickOpenExt.createInputBox(plugin);
},
registerTerminalLinkProvider(provider: theia.TerminalLinkProvider): void {
/* NOOP. To be implemented at later stage */
},
get activeColorTheme(): theia.ColorTheme {
return themingExt.activeColorTheme;
},
Expand Down
69 changes: 69 additions & 0 deletions packages/plugin/src/theia.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2871,6 +2871,67 @@ declare module '@theia/plugin' {
setDimensions?(dimensions: TerminalDimensions): void;
}

/**
* Provides information on a line in a terminal in order to provide links for it.
*/
export interface TerminalLinkContext {
/**
* This is the text from the unwrapped line in the terminal.
*/
line: string;

/**
* The terminal the link belongs to.
*/
terminal: Terminal;
}

/**
* A provider that enables detection and handling of links within terminals.
*/
export interface TerminalLinkProvider<T extends TerminalLink = TerminalLink> {
/**
* Provide terminal links for the given context. Note that this can be called multiple times
* even before previous calls resolve, make sure to not share global objects (eg. `RegExp`)
* that could have problems when asynchronous usage may overlap.
* @param context Information about what links are being provided for.
* @param token A cancellation token.
* @return A list of terminal links for the given line.
*/
provideTerminalLinks(context: TerminalLinkContext, token: CancellationToken): ProviderResult<T[]>;

/**
* Handle an activated terminal link.
* @param link The link to handle.
*/
handleTerminalLink(link: T): ProviderResult<void>;
}

/**
* A link on a terminal line.
*/
export interface TerminalLink {
/**
* The start index of the link on [TerminalLinkContext.line](#TerminalLinkContext.line].
*/
startIndex: number;

/**
* The length of the link on [TerminalLinkContext.line](#TerminalLinkContext.line]
*/
length: number;

/**
* The tooltip text when you hover over this link.
*
* If a tooltip is provided, is will be displayed in a string that includes instructions on
* how to trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary
* depending on OS, user settings, and localization.
*/
tooltip?: string;
}


/**
* A type of mutation that can be applied to an environment variable.
*/
Expand Down Expand Up @@ -3964,6 +4025,14 @@ declare module '@theia/plugin' {
*/
export function createInputBox(): InputBox;


/**
* Register provider that enables the detection and handling of links within the terminal.
* @param provider The provider that provides the terminal links.
* @return Disposable that unregisters the provider.
*/
export function registerTerminalLinkProvider(provider: TerminalLinkProvider): void;

/**
* The currently active color theme as configured in the settings. The active
* theme can be changed via the `workbench.colorTheme` setting.
Expand Down