Reputation: 1362
VSCODE can auto-detect links in the integrated terminal as below.
Can it be customized? Ex: All email IDs to be opened in the default mail app.
Upvotes: 4
Views: 885
Reputation: 1162
you will need to create extension that includes api call to vscode
here, there is code snippet to show how to add custom TerminalLinkProvider
:
window.registerTerminalLinkProvider({
provideTerminalLinks: (context, token) => {
// Detect the first instance of the word "test" if it exists and linkify it
const startIndex = (context.line as string).indexOf('test');
if (startIndex === -1) {
return [];
}
// Return an array of link results, this example only returns a single link
return [
{
startIndex,
length: 'test'.length,
tooltip: 'Show a notification',
// You can return data in this object to access inside handleTerminalLink
data: 'Example data'
}
];
},
handleTerminalLink: (link: any) => {
vscode.window.showInformationMessage(`Link activated (data = ${link.data})`);
}
});
there is simple extension that use this at github
and official guide for start your first extension.
you can build visx
to install in every vscode manually or publish it.
credit - Howto add a custom link provider
Upvotes: 2