How to get highlighted text from active terminal in VSCode Extension API

159 Views Asked by At

I am trying to build an extension using the VSCode API in which I need to get user's selected text wherever it is either in the activeTextEditor or activeTerminal. I see the way of getting the text from the selection for activeTextEditor. However, I am not able to find a way to get the highlighted text from activeTerminal. Appreciate any help on this.

vscode.window.activeTerminal
1

There are 1 best solutions below

0
On

It seems there is no API available for that. You have the activeTerminal, but not the content the user selected.

The closer API request I found what this one (https://github.com/microsoft/vscode/issues/47615), which was in fact connected with the activeTerminal API.

So, if you really need this feature, you should open a feature request in VS Code repo (https://github.com/microsoft/vscode/issues/new/choose) asking for this new API.

Hope this helps