如何从VSCode扩展API中的活动终端获取突出显示的文本。

huangapple go评论73阅读模式
英文:

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

问题

我正在尝试使用VSCode API构建一个扩展,其中我需要获取用户选择的文本,无论它是在activeTextEditor还是activeTerminal中。我知道如何从activeTextEditorselection中获取文本。然而,我无法找到从activeTerminal中获取突出显示文本的方法。感谢任何帮助。

vscode.window.activeTerminal
英文:

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

得分: 1

看起来没有提供相关的API。你有activeTerminal,但没有用户选择的内容。

我找到的最接近的API请求是这个(https://github.com/microsoft/vscode/issues/47615),实际上与activeTerminal API相关联。

所以,如果你确实需要这个功能,你应该在VS Code仓库(https://github.com/microsoft/vscode/issues/new/choose)中提出一个新的API请求,请求添加这个新的API。

希望这有所帮助。

英文:

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

huangapple
  • 本文由 发表于 2023年2月10日 12:31:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/75406964.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定