'can we customize link detection in VSCODE's integrated terminal
Solution 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | matan h |